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