.htaccess 2.7 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|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 5, Apache 1 and 2.
26 27 28 29
<IfModule mod_php5.c>
  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
33 34
</IfModule>

35
# Requires mod_expires to be enabled.
36
<IfModule mod_expires.c>
37 38
  # Enable expirations.
  ExpiresActive On
39

40 41
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
42

43
  # Do not cache dynamically generated pages.
44 45 46
  ExpiresByType text/html A1
</IfModule>

47
# Various rewrite rules.
48 49
<IfModule mod_rewrite.c>
  RewriteEngine on
Dries's avatar
 
Dries committed
50

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

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

77
  # Rewrite URLs of the form 'index.php?q=x'.
Dries's avatar
 
Dries committed
78 79
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
Dries's avatar
 
Dries committed
80
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
81 82 83
</IfModule>

# $Id$