.htaccess 2.98 KB
Newer Older
1
#
2
# Apache/PHP/Drupal settings:
3 4
#

5
# Protect files and directories from prying eyes.
6
<FilesMatch "\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
7
  Order allow,deny
8
</FilesMatch>
Dries's avatar
 
Dries committed
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
Dries's avatar
 
Dries committed
15

16
# Make Drupal handle any 404 errors.
Dries's avatar
 
Dries committed
17 18
ErrorDocument 404 /index.php

19 20
# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
21
  ErrorDocument 404 "The requested file favicon.ico was not found.
22 23
</Files>

24
# Set the default handler.
Dries's avatar
Dries committed
25
DirectoryIndex index.php
26

27 28 29
# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

30
# PHP 5, Apache 1 and 2.
31
<IfModule mod_php5.c>
32 33 34
  php_flag magic_quotes_gpc                 off
  php_flag register_globals                 off
  php_flag session.auto_start               off
35 36
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
37
  php_flag mbstring.encoding_translation    off
38 39
</IfModule>

40
# Requires mod_expires to be enabled.
41
<IfModule mod_expires.c>
42 43
  # Enable expirations.
  ExpiresActive On
44

45 46
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
47

48
  # Do not cache dynamically generated pages.
49 50 51
  ExpiresByType text/html A1
</IfModule>

52
# Various rewrite rules.
53 54
<IfModule mod_rewrite.c>
  RewriteEngine on
Dries's avatar
 
Dries committed
55

56 57 58
  # 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:
59
  #
60 61 62
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
63
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
64
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
65
  #
66
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
67
  # (http://www.example.com/... will be redirected to http://example.com/...)
68
  # uncomment and adapt the following:
69
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
70
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
71

72 73 74 75 76 77
  # 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
  #
78
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
79 80
  # uncomment the following line:
  # RewriteBase /
Dries's avatar
Dries committed
81

82
  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
Dries's avatar
 
Dries committed
83 84
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
85
  RewriteCond %{REQUEST_URI} !=/favicon.ico
Dries's avatar
 
Dries committed
86
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
87 88 89
</IfModule>

# $Id$