SHOW:
|
|
- or go back to the newest paste.
1 | # | |
2 | # Apache/PHP/Drupal settings: | |
3 | # | |
4 | ||
5 | # Protect files and directories from prying eyes. | |
6 | <FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$"> | |
7 | Order allow,deny | |
8 | </FilesMatch> | |
9 | ||
10 | # Don't show directory listings for URLs which map to a directory. | |
11 | Options -Indexes | |
12 | ||
13 | # Follow symbolic links in this directory. | |
14 | Options +FollowSymLinks | |
15 | ||
16 | # Make Drupal handle any 404 errors. | |
17 | ErrorDocument 404 /index.php | |
18 | ||
19 | # Set the default handler. | |
20 | DirectoryIndex index.php index.html index.htm | |
21 | ||
22 | # Override PHP settings that cannot be changed at runtime. See | |
23 | # sites/default/default.settings.php and drupal_environment_initialize() in | |
24 | # includes/bootstrap.inc for settings that can be changed at runtime. | |
25 | ||
26 | # PHP 5, Apache 1 and 2. | |
27 | <IfModule mod_php5.c> | |
28 | php_flag magic_quotes_gpc off | |
29 | php_flag magic_quotes_sybase off | |
30 | php_flag register_globals off | |
31 | php_flag session.auto_start off | |
32 | php_value mbstring.http_input pass | |
33 | php_value mbstring.http_output pass | |
34 | php_flag mbstring.encoding_translation off | |
35 | </IfModule> | |
36 | ||
37 | # Requires mod_expires to be enabled. | |
38 | <IfModule mod_expires.c> | |
39 | # Enable expirations. | |
40 | ExpiresActive On | |
41 | ||
42 | # Cache all files for 2 weeks after access (A). | |
43 | ExpiresDefault A1209600 | |
44 | ||
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. | |
51 | ExpiresActive Off | |
52 | </FilesMatch> | |
53 | </IfModule> | |
54 | ||
55 | # Various rewrite rules. | |
56 | <IfModule mod_rewrite.c> | |
57 | RewriteEngine on | |
58 | ||
59 | # Set "protossl" to "s" if we were accessed via https://. This is used later | |
60 | # if you enable "www." stripping or enforcement, in order to ensure that | |
61 | # you don't bounce between http and https. | |
62 | RewriteRule ^ - [E=protossl] | |
63 | RewriteCond %{HTTPS} on | |
64 | RewriteRule ^ - [E=protossl:s] | |
65 | ||
66 | # Make sure Authorization HTTP header is available to PHP | |
67 | # even when running as CGI or FastCGI. | |
68 | RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
69 | ||
70 | # Block access to "hidden" directories whose names begin with a period. This | |
71 | # includes directories used by version control systems such as Subversion or | |
72 | # Git to store control files. Files whose names begin with a period, as well | |
73 | # as the control files used by CVS, are protected by the FilesMatch directive | |
74 | # above. | |
75 | # | |
76 | # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is | |
77 | # not possible to block access to entire directories from .htaccess, because | |
78 | # <DirectoryMatch> is not allowed here. | |
79 | # | |
80 | # If you do not have mod_rewrite installed, you should remove these | |
81 | # directories from your webroot or otherwise protect them from being | |
82 | # downloaded. | |
83 | RewriteRule "(^|/)\." - [F] | |
84 | ||
85 | # If your site can be accessed both with and without the 'www.' prefix, you | |
86 | # can use one of the following settings to redirect users to your preferred | |
87 | # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option: | |
88 | # | |
89 | # To redirect all users to access the site WITH the 'www.' prefix, | |
90 | # (http://example.com/... will be redirected to http://www.example.com/...) | |
91 | # uncomment the following: | |
92 | RewriteCond %{HTTP_HOST} . | |
93 | RewriteCond %{HTTP_HOST} !^www\. [NC] | |
94 | RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
95 | # | |
96 | # To redirect all users to access the site WITHOUT the 'www.' prefix, | |
97 | # (http://www.example.com/... will be redirected to http://example.com/...) | |
98 | # uncomment the following: | |
99 | # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] | |
100 | # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301] | |
101 | ||
102 | # Modify the RewriteBase if you are using Drupal in a subdirectory or in a | |
103 | # VirtualDocumentRoot and the rewrite rules are not working properly. | |
104 | # For example if your site is at http://example.com/drupal uncomment and | |
105 | # modify the following line: | |
106 | # RewriteBase /drupal | |
107 | # | |
108 | # If your site is running in a VirtualDocumentRoot at http://example.com/, | |
109 | # uncomment the following line: | |
110 | RewriteBase / | |
111 | #custom redirects | |
112 | ||
113 | DirectorySlash Off | |
114 | ||
115 | ||
116 | ||
117 | ||
118 | # booking form redirect | |
119 | - | # e.g. booking/AUUO8 > booking-request?trip_code=AUUO8 |
119 | + | |
120 | ||
121 | ||
122 | ||
123 | #redirect requests to /node or /node?page=## | |
124 | RewriteRule ^node$ /? [R=301,L] | |
125 | ||
126 | ||
127 | #end custom redirects | |
128 | ||
129 | ### BOOST START ### | |
130 | ||
131 | # Allow for alt paths to be set via htaccess rules; allows for cached variants (future mobile support) | |
132 | RewriteRule .* - [E=boostpath:normal] | |
133 | ||
134 | # Caching for anonymous users | |
135 | # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request | |
136 | RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR] | |
137 | RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR] | |
138 | RewriteCond %{HTTPS} on [OR] | |
139 | RewriteCond %{HTTP_COOKIE} DRUPAL_UID | |
140 | RewriteRule .* - [S=3] | |
141 | ||
142 | # GZIP | |
143 | RewriteCond %{HTTP:Accept-encoding} !gzip | |
144 | RewriteRule .* - [S=1] | |
145 | RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s | |
146 | RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html,E=no-gzip:1] | |
147 | ||
148 | # NORMAL | |
149 | RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s | |
150 | RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html] | |
151 | ||
152 | ### BOOST END ### | |
153 | ||
154 | # Pass all requests not referring directly to files in the filesystem to | |
155 | # index.php. Clean URLs are handled in drupal_environment_initialize(). | |
156 | RewriteCond %{REQUEST_FILENAME} !-f | |
157 | RewriteCond %{REQUEST_FILENAME} !-d | |
158 | RewriteCond %{REQUEST_URI} !=/favicon.ico | |
159 | RewriteRule ^ index.php [L] | |
160 | ||
161 | # Rules to correctly serve gzip compressed CSS and JS files. | |
162 | # Requires both mod_rewrite and mod_headers to be enabled. | |
163 | <IfModule mod_headers.c> | |
164 | # Serve gzip compressed CSS files if they exist and the client accepts gzip. | |
165 | RewriteCond %{HTTP:Accept-encoding} gzip | |
166 | RewriteCond %{REQUEST_FILENAME}\.gz -s | |
167 | RewriteRule ^(.*)\.css $1\.css\.gz [QSA] | |
168 | ||
169 | # Serve gzip compressed JS files if they exist and the client accepts gzip. | |
170 | RewriteCond %{HTTP:Accept-encoding} gzip | |
171 | RewriteCond %{REQUEST_FILENAME}\.gz -s | |
172 | RewriteRule ^(.*)\.js $1\.js\.gz [QSA] | |
173 | ||
174 | # Serve correct content types, and prevent mod_deflate double gzip. | |
175 | RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1] | |
176 | RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1] | |
177 | ||
178 | <FilesMatch "(\.js\.gz|\.css\.gz)$"> | |
179 | # Serve correct encoding type. | |
180 | Header set Content-Encoding gzip | |
181 | # Force proxies to cache gzipped & non-gzipped css/js files separately. | |
182 | Header append Vary Accept-Encoding | |
183 | </FilesMatch> | |
184 | </IfModule> | |
185 | </IfModule> |