Issue #1393846 by tedbow, Albert Volkman: Fixed path_form_element_validate() executes...
[project/drupal.git] / .htaccess
CommitLineData
9bd920de 1#
2eec4e80 2# Apache/PHP/Drupal settings:
9bd920de
DB
3#
4
2eec4e80 5# Protect files and directories from prying eyes.
84d99944 6<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
94fbfe8b 7 Order allow,deny
316e3578 8</FilesMatch>
c1a88d5d 9
1b1ceb6e 10# Don't show directory listings for URLs which map to a directory.
cd401235 11Options -Indexes
1b1ceb6e
ND
12
13# Follow symbolic links in this directory.
63c2d329 14Options +FollowSymLinks
594aff05 15
34fd475f 16# Make Drupal handle any 404 errors.
033b2e2c
DB
17ErrorDocument 404 /index.php
18
2eec4e80 19# Set the default handler.
2a562943 20DirectoryIndex index.php index.html index.htm
cd401235 21
6608f70c
DB
22# Override PHP settings that cannot be changed at runtime. See
23# sites/default/default.settings.php and drupal_initialize_variables() in
24# includes/bootstrap.inc for settings that can be changed at runtime.
b4933bcd 25
1b1ceb6e 26# PHP 5, Apache 1 and 2.
b4933bcd 27<IfModule mod_php5.c>
4ebaf8b6 28 php_flag magic_quotes_gpc off
d046c0c2 29 php_flag magic_quotes_sybase off
4ebaf8b6
DB
30 php_flag register_globals off
31 php_flag session.auto_start off
6f94dc3c
SW
32 php_value mbstring.http_input pass
33 php_value mbstring.http_output pass
4ebaf8b6 34 php_flag mbstring.encoding_translation off
2eec4e80
DB
35</IfModule>
36
50535ab3 37# Requires mod_expires to be enabled.
59e86f61 38<IfModule mod_expires.c>
50535ab3
DB
39 # Enable expirations.
40 ExpiresActive On
a6674e22 41
50535ab3
DB
42 # Cache all files for 2 weeks after access (A).
43 ExpiresDefault A1209600
a6674e22 44
3df77d6b
DB
45 <FilesMatch \.php$>
46 # Do not allow PHP scripts to be cached unless they explicitly send cache
47 # headers themselves. Otherwise all scripts would have to overwrite the
48 # headers set by mod_expires if they want another caching behavior. This may
49 # fail if an error occurs early in the bootstrap process, and it may cause
50 # problems if a non-Drupal PHP file is installed in a subdirectory.
526401c4 51 ExpiresActive Off
3df77d6b 52 </FilesMatch>
59e86f61
SW
53</IfModule>
54
2eec4e80 55# Various rewrite rules.
01a8b5ed 56<IfModule mod_rewrite.c>
57 RewriteEngine on
07bb6786 58
84d99944
AB
59 # Block access to "hidden" directories whose names begin with a period. This
60 # includes directories used by version control systems such as Subversion or
61 # Git to store control files. Files whose names begin with a period, as well
62 # as the control files used by CVS, are protected by the FilesMatch directive
63 # above.
64 #
65 # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
66 # not possible to block access to entire directories from .htaccess, because
67 # <DirectoryMatch> is not allowed here.
68 #
69 # If you do not have mod_rewrite installed, you should remove these
70 # directories from your webroot or otherwise protect them from being
71 # downloaded.
72 RewriteRule "(^|/)\." - [F]
73
cc62bb26
DB
74 # If your site can be accessed both with and without the 'www.' prefix, you
75 # can use one of the following settings to redirect users to your preferred
76 # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
69726b0d 77 #
cc62bb26
DB
78 # To redirect all users to access the site WITH the 'www.' prefix,
79 # (http://example.com/... will be redirected to http://www.example.com/...)
8f2c63ea
DB
80 # uncomment the following:
81 # RewriteCond %{HTTP_HOST} !^www\. [NC]
82 # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
69726b0d 83 #
0b42d1dc 84 # To redirect all users to access the site WITHOUT the 'www.' prefix,
cc62bb26 85 # (http://www.example.com/... will be redirected to http://example.com/...)
8f2c63ea
DB
86 # uncomment the following:
87 # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
88 # RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
69726b0d 89
a6674e22
H
90 # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
91 # VirtualDocumentRoot and the rewrite rules are not working properly.
92 # For example if your site is at http://example.com/drupal uncomment and
93 # modify the following line:
94 # RewriteBase /drupal
95 #
c389c905 96 # If your site is running in a VirtualDocumentRoot at http://example.com/,
a6674e22
H
97 # uncomment the following line:
98 # RewriteBase /
e4695fd5 99
1df3cfff
DB
100 # Pass all requests not referring directly to files in the filesystem to
101 # index.php. Clean URLs are handled in drupal_environment_initialize().
d0387297
DB
102 RewriteCond %{REQUEST_FILENAME} !-f
103 RewriteCond %{REQUEST_FILENAME} !-d
34fd475f 104 RewriteCond %{REQUEST_URI} !=/favicon.ico
1df3cfff 105 RewriteRule ^ index.php [L]
563c673e
DB
106
107 # Rules to correctly serve gzip compressed CSS and JS files.
108 # Requires both mod_rewrite and mod_headers to be enabled.
109 <IfModule mod_headers.c>
110 # Serve gzip compressed CSS files if they exist and the client accepts gzip.
111 RewriteCond %{HTTP:Accept-encoding} gzip
112 RewriteCond %{REQUEST_FILENAME}\.gz -s
113 RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
114
115 # Serve gzip compressed JS files if they exist and the client accepts gzip.
116 RewriteCond %{HTTP:Accept-encoding} gzip
117 RewriteCond %{REQUEST_FILENAME}\.gz -s
118 RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
119
120 # Serve correct content types, and prevent mod_deflate double gzip.
121 RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
122 RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
123
124 <FilesMatch "(\.js\.gz|\.css\.gz)$">
125 # Serve correct encoding type.
e7b5088e 126 Header set Content-Encoding gzip
563c673e
DB
127 # Force proxies to cache gzipped & non-gzipped css/js files separately.
128 Header append Vary Accept-Encoding
129 </FilesMatch>
130 </IfModule>
cd401235 131</IfModule>