danielebarchiesi@1: #
danielebarchiesi@1: # Apache/PHP/Drupal settings:
danielebarchiesi@1: #
danielebarchiesi@1:
danielebarchiesi@1: # Protect files and directories from prying eyes.
danielebarchiesi@1:
danielebarchiesi@1: Order allow,deny
danielebarchiesi@1:
danielebarchiesi@1:
danielebarchiesi@1: # Don't show directory listings for URLs which map to a directory.
danielebarchiesi@1: Options -Indexes
danielebarchiesi@1:
danielebarchiesi@1: # Follow symbolic links in this directory.
danielebarchiesi@1: Options +FollowSymLinks
danielebarchiesi@1:
danielebarchiesi@1: # Make Drupal handle any 404 errors.
danielebarchiesi@1: ErrorDocument 404 /index.php
danielebarchiesi@1:
danielebarchiesi@1: # Set the default handler.
danielebarchiesi@1: DirectoryIndex index.php index.html index.htm
danielebarchiesi@1:
danielebarchiesi@1: # Override PHP settings that cannot be changed at runtime. See
danielebarchiesi@1: # sites/default/default.settings.php and drupal_environment_initialize() in
danielebarchiesi@1: # includes/bootstrap.inc for settings that can be changed at runtime.
danielebarchiesi@1:
danielebarchiesi@1: # PHP 5, Apache 1 and 2.
danielebarchiesi@1:
danielebarchiesi@1: php_flag magic_quotes_gpc off
danielebarchiesi@1: php_flag magic_quotes_sybase off
danielebarchiesi@1: php_flag register_globals off
danielebarchiesi@1: php_flag session.auto_start off
danielebarchiesi@1: php_value mbstring.http_input pass
danielebarchiesi@1: php_value mbstring.http_output pass
danielebarchiesi@1: php_flag mbstring.encoding_translation off
danielebarchiesi@1:
danielebarchiesi@1:
danielebarchiesi@1: # Requires mod_expires to be enabled.
danielebarchiesi@1:
danielebarchiesi@1: # Enable expirations.
danielebarchiesi@1: ExpiresActive On
danielebarchiesi@1:
danielebarchiesi@1: # Cache all files for 2 weeks after access (A).
danielebarchiesi@1: ExpiresDefault A1209600
danielebarchiesi@1:
danielebarchiesi@1:
danielebarchiesi@1: # Do not allow PHP scripts to be cached unless they explicitly send cache
danielebarchiesi@1: # headers themselves. Otherwise all scripts would have to overwrite the
danielebarchiesi@1: # headers set by mod_expires if they want another caching behavior. This may
danielebarchiesi@1: # fail if an error occurs early in the bootstrap process, and it may cause
danielebarchiesi@1: # problems if a non-Drupal PHP file is installed in a subdirectory.
danielebarchiesi@1: ExpiresActive Off
danielebarchiesi@1:
danielebarchiesi@1:
danielebarchiesi@1:
danielebarchiesi@1: # Various rewrite rules.
danielebarchiesi@1:
danielebarchiesi@1: RewriteEngine on
danielebarchiesi@1:
danielebarchiesi@1: # Set "protossl" to "s" if we were accessed via https://. This is used later
danielebarchiesi@1: # if you enable "www." stripping or enforcement, in order to ensure that
danielebarchiesi@1: # you don't bounce between http and https.
danielebarchiesi@1: RewriteRule ^ - [E=protossl]
danielebarchiesi@1: RewriteCond %{HTTPS} on
danielebarchiesi@1: RewriteRule ^ - [E=protossl:s]
danielebarchiesi@1:
danielebarchiesi@1: # Make sure Authorization HTTP header is available to PHP
danielebarchiesi@1: # even when running as CGI or FastCGI.
danielebarchiesi@1: RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
danielebarchiesi@1:
danielebarchiesi@1: # Block access to "hidden" directories whose names begin with a period. This
danielebarchiesi@1: # includes directories used by version control systems such as Subversion or
danielebarchiesi@1: # Git to store control files. Files whose names begin with a period, as well
danielebarchiesi@1: # as the control files used by CVS, are protected by the FilesMatch directive
danielebarchiesi@1: # above.
danielebarchiesi@1: #
danielebarchiesi@1: # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
danielebarchiesi@1: # not possible to block access to entire directories from .htaccess, because
danielebarchiesi@1: # is not allowed here.
danielebarchiesi@1: #
danielebarchiesi@1: # If you do not have mod_rewrite installed, you should remove these
danielebarchiesi@1: # directories from your webroot or otherwise protect them from being
danielebarchiesi@1: # downloaded.
danielebarchiesi@1: RewriteRule "(^|/)\." - [F]
danielebarchiesi@1:
danielebarchiesi@1: # If your site can be accessed both with and without the 'www.' prefix, you
danielebarchiesi@1: # can use one of the following settings to redirect users to your preferred
danielebarchiesi@1: # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
danielebarchiesi@1: #
danielebarchiesi@1: # To redirect all users to access the site WITH the 'www.' prefix,
danielebarchiesi@1: # (http://example.com/... will be redirected to http://www.example.com/...)
danielebarchiesi@1: # uncomment the following:
danielebarchiesi@1: # RewriteCond %{HTTP_HOST} .
danielebarchiesi@1: # RewriteCond %{HTTP_HOST} !^www\. [NC]
danielebarchiesi@1: # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
danielebarchiesi@1: #
danielebarchiesi@1: # To redirect all users to access the site WITHOUT the 'www.' prefix,
danielebarchiesi@1: # (http://www.example.com/... will be redirected to http://example.com/...)
danielebarchiesi@1: # uncomment the following:
danielebarchiesi@1: # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
danielebarchiesi@1: # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
danielebarchiesi@1:
danielebarchiesi@1: # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
danielebarchiesi@1: # VirtualDocumentRoot and the rewrite rules are not working properly.
danielebarchiesi@1: # For example if your site is at http://example.com/drupal uncomment and
danielebarchiesi@1: # modify the following line:
danielebarchiesi@1: # RewriteBase /drupal
danielebarchiesi@1: #
danielebarchiesi@1: # If your site is running in a VirtualDocumentRoot at http://example.com/,
danielebarchiesi@1: # uncomment the following line:
danielebarchiesi@1: # RewriteBase /
danielebarchiesi@1:
danielebarchiesi@1: # Pass all requests not referring directly to files in the filesystem to
danielebarchiesi@1: # index.php. Clean URLs are handled in drupal_environment_initialize().
danielebarchiesi@1: RewriteCond %{REQUEST_FILENAME} !-f
danielebarchiesi@1: RewriteCond %{REQUEST_FILENAME} !-d
danielebarchiesi@1: RewriteCond %{REQUEST_URI} !=/favicon.ico
danielebarchiesi@1: RewriteRule ^ index.php [L]
danielebarchiesi@1:
danielebarchiesi@1: # Rules to correctly serve gzip compressed CSS and JS files.
danielebarchiesi@1: # Requires both mod_rewrite and mod_headers to be enabled.
danielebarchiesi@1:
danielebarchiesi@1: # Serve gzip compressed CSS files if they exist and the client accepts gzip.
danielebarchiesi@1: RewriteCond %{HTTP:Accept-encoding} gzip
danielebarchiesi@1: RewriteCond %{REQUEST_FILENAME}\.gz -s
danielebarchiesi@1: RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
danielebarchiesi@1:
danielebarchiesi@1: # Serve gzip compressed JS files if they exist and the client accepts gzip.
danielebarchiesi@1: RewriteCond %{HTTP:Accept-encoding} gzip
danielebarchiesi@1: RewriteCond %{REQUEST_FILENAME}\.gz -s
danielebarchiesi@1: RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
danielebarchiesi@1:
danielebarchiesi@1: # Serve correct content types, and prevent mod_deflate double gzip.
danielebarchiesi@1: RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
danielebarchiesi@1: RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
danielebarchiesi@1:
danielebarchiesi@1:
danielebarchiesi@1: # Serve correct encoding type.
danielebarchiesi@1: Header set Content-Encoding gzip
danielebarchiesi@1: # Force proxies to cache gzipped & non-gzipped css/js files separately.
danielebarchiesi@1: Header append Vary Accept-Encoding
danielebarchiesi@1:
danielebarchiesi@1:
danielebarchiesi@1: