.htaccess 3.1 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|po|schema|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
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
# Customized error messages.
Dries's avatar
 
Dries committed
17 18
ErrorDocument 404 /index.php

19
# Set the default handler.
Dries's avatar
Dries committed
20
DirectoryIndex index.php
21

22 23 24
# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

25
# PHP 4, Apache 1.
Dries's avatar
 
Dries committed
26
<IfModule mod_php4.c>
27 28 29
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
30 31 32
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
Dries's avatar
 
Dries committed
33
</IfModule>
34

35
# PHP 4, Apache 2.
36
<IfModule sapi_apache2.c>
37 38 39
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
40 41 42
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
43 44
</IfModule>

45
# PHP 5, Apache 1 and 2.
46 47 48 49
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
50 51 52
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
53 54
</IfModule>

55
# Requires mod_expires to be enabled.
56
<IfModule mod_expires.c>
57 58 59 60 61
  # Enable expirations.
  ExpiresActive On
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
  # Do not cache dynamically generated pages.
62 63 64
  ExpiresByType text/html A1
</IfModule>

65
# Various rewrite rules.
66 67
<IfModule mod_rewrite.c>
  RewriteEngine on
Dries's avatar
 
Dries committed
68

69 70 71
  # 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:
72
  #
73 74 75
  # 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:
76
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
77
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
78
  #
79
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
80 81
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # adapt and uncomment the following:
82
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
83
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
84

85
  # Modify the RewriteBase if you are using Drupal in a subdirectory and
86
  # the rewrite rules are not working properly.
Dries's avatar
Dries committed
87 88
  #RewriteBase /drupal

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

# $Id$