.htaccess 3.25 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
  # There is no end quote below, for compatibility with Apache 1.3.
22
  ErrorDocument 404 "The requested file favicon.ico was not found.
23 24
</Files>

25
# Set the default handler.
26
DirectoryIndex index.php index.html index.htm
27

28 29 30
# Override PHP settings that cannot be changed at runtime. See
# sites/default/default.settings.php and drupal_initialize_variables() in
# includes/bootstrap.inc for settings that can be changed at runtime.
31

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

43
# Requires mod_expires to be enabled.
44
<IfModule mod_expires.c>
45 46
  # Enable expirations.
  ExpiresActive On
47

48 49
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
50

51 52 53 54
  <Files index.php>
    # Caching headers for dynamically generated pages are set from PHP.
    ExpiresActive Off
  </Files>
55 56
</IfModule>

57
# Various rewrite rules.
58 59
<IfModule mod_rewrite.c>
  RewriteEngine on
Dries's avatar
 
Dries committed
60

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

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

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

# $Id$