2000-05-28 09:23:56 +00:00
|
|
|
#
|
2005-03-12 10:42:48 +00:00
|
|
|
# Apache/PHP/Drupal settings:
|
2000-05-28 09:23:56 +00:00
|
|
|
#
|
|
|
|
|
2005-03-12 10:42:48 +00:00
|
|
|
# Protect files and directories from prying eyes.
|
2010-02-07 05:20:21 +00:00
|
|
|
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
|
2006-11-29 06:16:14 +00:00
|
|
|
Order allow,deny
|
2005-12-01 16:02:09 +00:00
|
|
|
</FilesMatch>
|
2000-12-16 08:39:01 +00:00
|
|
|
|
2006-05-01 08:32:56 +00:00
|
|
|
# Don't show directory listings for URLs which map to a directory.
|
2001-11-24 13:18:58 +00:00
|
|
|
Options -Indexes
|
2006-05-01 08:32:56 +00:00
|
|
|
|
|
|
|
# Follow symbolic links in this directory.
|
2004-10-09 20:41:49 +00:00
|
|
|
Options +FollowSymLinks
|
2003-06-26 04:54:01 +00:00
|
|
|
|
2008-06-26 19:19:44 +00:00
|
|
|
# Make Drupal handle any 404 errors.
|
2003-12-18 18:53:11 +00:00
|
|
|
ErrorDocument 404 /index.php
|
|
|
|
|
2005-03-12 10:42:48 +00:00
|
|
|
# Set the default handler.
|
2009-05-16 13:19:12 +00:00
|
|
|
DirectoryIndex index.php index.html index.htm
|
2001-11-24 13:18:58 +00:00
|
|
|
|
2008-11-22 13:46:11 +00:00
|
|
|
# Override PHP settings that cannot be changed at runtime. See
|
2012-05-17 01:27:25 +00:00
|
|
|
# sites/default/default.settings.php and drupal_environment_initialize() in
|
|
|
|
# core/includes/bootstrap.inc for settings that can be changed at runtime.
|
2006-02-08 20:42:29 +00:00
|
|
|
|
2006-05-01 08:32:56 +00:00
|
|
|
# PHP 5, Apache 1 and 2.
|
2006-02-08 20:42:29 +00:00
|
|
|
<IfModule mod_php5.c>
|
2008-09-15 15:21:44 +00:00
|
|
|
php_flag magic_quotes_gpc off
|
2009-01-09 02:49:01 +00:00
|
|
|
php_flag magic_quotes_sybase off
|
2008-09-15 15:21:44 +00:00
|
|
|
php_flag register_globals off
|
|
|
|
php_flag session.auto_start off
|
2007-04-07 11:05:06 +00:00
|
|
|
php_value mbstring.http_input pass
|
|
|
|
php_value mbstring.http_output pass
|
2008-09-15 15:21:44 +00:00
|
|
|
php_flag mbstring.encoding_translation off
|
2005-03-12 10:42:48 +00:00
|
|
|
</IfModule>
|
|
|
|
|
2007-01-09 09:27:10 +00:00
|
|
|
# Requires mod_expires to be enabled.
|
2005-02-21 04:01:24 +00:00
|
|
|
<IfModule mod_expires.c>
|
2007-01-09 09:27:10 +00:00
|
|
|
# Enable expirations.
|
|
|
|
ExpiresActive On
|
2007-09-07 12:26:59 +00:00
|
|
|
|
2007-01-09 09:27:10 +00:00
|
|
|
# Cache all files for 2 weeks after access (A).
|
|
|
|
ExpiresDefault A1209600
|
2007-09-07 12:26:59 +00:00
|
|
|
|
2009-08-16 12:10:36 +00:00
|
|
|
<FilesMatch \.php$>
|
|
|
|
# Do not allow PHP scripts to be cached unless they explicitly send cache
|
|
|
|
# headers themselves. Otherwise all scripts would have to overwrite the
|
|
|
|
# headers set by mod_expires if they want another caching behavior. This may
|
|
|
|
# fail if an error occurs early in the bootstrap process, and it may cause
|
|
|
|
# problems if a non-Drupal PHP file is installed in a subdirectory.
|
2009-04-22 09:45:03 +00:00
|
|
|
ExpiresActive Off
|
2009-08-16 12:10:36 +00:00
|
|
|
</FilesMatch>
|
2005-02-21 04:01:24 +00:00
|
|
|
</IfModule>
|
|
|
|
|
2005-03-12 10:42:48 +00:00
|
|
|
# Various rewrite rules.
|
2001-07-14 14:28:32 +00:00
|
|
|
<IfModule mod_rewrite.c>
|
|
|
|
RewriteEngine on
|
2003-03-11 12:57:13 +00:00
|
|
|
|
2010-02-07 05:20:21 +00:00
|
|
|
# Block access to "hidden" directories whose names begin with a period. This
|
|
|
|
# includes directories used by version control systems such as Subversion or
|
|
|
|
# Git to store control files. Files whose names begin with a period, as well
|
|
|
|
# as the control files used by CVS, are protected by the FilesMatch directive
|
|
|
|
# above.
|
|
|
|
#
|
|
|
|
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
|
2011-10-01 19:47:01 +00:00
|
|
|
# not possible to block access to entire directories from .htaccess because
|
2010-02-07 05:20:21 +00:00
|
|
|
# <DirectoryMatch> is not allowed here.
|
|
|
|
#
|
|
|
|
# If you do not have mod_rewrite installed, you should remove these
|
|
|
|
# directories from your webroot or otherwise protect them from being
|
|
|
|
# downloaded.
|
|
|
|
RewriteRule "(^|/)\." - [F]
|
|
|
|
|
2007-05-18 17:44:29 +00:00
|
|
|
# If your site can be accessed both with and without the 'www.' prefix, you
|
|
|
|
# can use one of the following settings to redirect users to your preferred
|
|
|
|
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
|
2006-04-12 08:42:47 +00:00
|
|
|
#
|
2007-05-18 17:44:29 +00:00
|
|
|
# To redirect all users to access the site WITH the 'www.' prefix,
|
|
|
|
# (http://example.com/... will be redirected to http://www.example.com/...)
|
2009-06-09 05:08:16 +00:00
|
|
|
# uncomment the following:
|
|
|
|
# RewriteCond %{HTTP_HOST} !^www\. [NC]
|
|
|
|
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
2006-04-12 08:42:47 +00:00
|
|
|
#
|
2007-05-18 22:09:45 +00:00
|
|
|
# To redirect all users to access the site WITHOUT the 'www.' prefix,
|
2007-05-18 17:44:29 +00:00
|
|
|
# (http://www.example.com/... will be redirected to http://example.com/...)
|
2009-06-09 05:08:16 +00:00
|
|
|
# uncomment the following:
|
|
|
|
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
|
|
|
# RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
|
2006-04-12 08:42:47 +00:00
|
|
|
|
2007-09-07 12:26:59 +00:00
|
|
|
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
|
|
|
|
# VirtualDocumentRoot and the rewrite rules are not working properly.
|
|
|
|
# For example if your site is at http://example.com/drupal uncomment and
|
|
|
|
# modify the following line:
|
|
|
|
# RewriteBase /drupal
|
|
|
|
#
|
2007-10-02 16:03:17 +00:00
|
|
|
# If your site is running in a VirtualDocumentRoot at http://example.com/,
|
2007-09-07 12:26:59 +00:00
|
|
|
# uncomment the following line:
|
|
|
|
# RewriteBase /
|
2003-09-18 20:32:23 +00:00
|
|
|
|
2011-10-31 04:05:57 +00:00
|
|
|
# Redirect common PHP files to their new locations.
|
|
|
|
RewriteCond %{REQUEST_URI} ^(.*)?/(update.php) [OR]
|
2012-05-07 02:50:05 +00:00
|
|
|
RewriteCond %{REQUEST_URI} ^(.*)?/(install.php)
|
2011-10-31 04:05:57 +00:00
|
|
|
RewriteCond %{REQUEST_URI} !core
|
|
|
|
RewriteRule ^ %1/core/%2 [L,QSA,R=301]
|
|
|
|
|
2010-01-29 22:40:41 +00:00
|
|
|
# Pass all requests not referring directly to files in the filesystem to
|
|
|
|
# index.php. Clean URLs are handled in drupal_environment_initialize().
|
2003-02-14 19:52:45 +00:00
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
2008-06-26 19:19:44 +00:00
|
|
|
RewriteCond %{REQUEST_URI} !=/favicon.ico
|
2010-01-29 22:40:41 +00:00
|
|
|
RewriteRule ^ index.php [L]
|
2010-10-11 23:49:48 +00:00
|
|
|
|
|
|
|
# Rules to correctly serve gzip compressed CSS and JS files.
|
|
|
|
# Requires both mod_rewrite and mod_headers to be enabled.
|
|
|
|
<IfModule mod_headers.c>
|
|
|
|
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
|
|
|
|
RewriteCond %{HTTP:Accept-encoding} gzip
|
|
|
|
RewriteCond %{REQUEST_FILENAME}\.gz -s
|
|
|
|
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
|
|
|
|
|
|
|
|
# Serve gzip compressed JS files if they exist and the client accepts gzip.
|
|
|
|
RewriteCond %{HTTP:Accept-encoding} gzip
|
|
|
|
RewriteCond %{REQUEST_FILENAME}\.gz -s
|
|
|
|
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
|
|
|
|
|
|
|
|
# Serve correct content types, and prevent mod_deflate double gzip.
|
|
|
|
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
|
|
|
|
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
|
|
|
|
|
|
|
|
<FilesMatch "(\.js\.gz|\.css\.gz)$">
|
|
|
|
# Serve correct encoding type.
|
2011-09-19 00:41:59 +00:00
|
|
|
Header set Content-Encoding gzip
|
2010-10-11 23:49:48 +00:00
|
|
|
# Force proxies to cache gzipped & non-gzipped css/js files separately.
|
|
|
|
Header append Vary Accept-Encoding
|
|
|
|
</FilesMatch>
|
|
|
|
</IfModule>
|
2001-11-24 13:18:58 +00:00
|
|
|
</IfModule>
|