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

5
# Protect files and directories from prying eyes.
6
<FilesMatch "(\.(engine|inc|install|module|profile|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root)$">
7 8
  Order deny,allow
  Deny from all
9
</FilesMatch>
10

11
# Don't show directory listings for URLs which map to a directory.
12
Options -Indexes
13 14

# Follow symbolic links in this directory.
15
Options +FollowSymLinks
16

17
# Customized error messages.
18 19
ErrorDocument 404 /index.php

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

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

26
# PHP 4, Apache 1.
Dries's avatar
Dries committed
27
<IfModule mod_php4.c>
28 29 30
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
31
</IfModule>
32

33
# PHP 4, Apache 2.
34
<IfModule sapi_apache2.c>
35 36 37
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
38 39
</IfModule>

40
# PHP 5, Apache 1 and 2.
41 42 43 44
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
45 46
</IfModule>

47
# Reduce the time dynamically generated pages are cache-able.
48 49 50 51
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>

52
# Various rewrite rules.
53 54
<IfModule mod_rewrite.c>
  RewriteEngine on
55

56 57
  # If your site can be accessed both with and without the prefix www. you
  # can use one of the following settings to force user to use only one option:
58
  #
59 60
  # If you want the site to be accessed WITH the www. only, adapt and
  # uncomment the following:
61 62 63
  # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
  # RewriteRule .* http://www.example.com/ [L,R=301]
  #
64 65
  # If you want the site to be accessed only WITHOUT the www. prefix, adapt
  # and uncomment the following:
66 67 68
  # RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  # RewriteRule .* http://example.com/ [L,R=301]

69
  # Modify the RewriteBase if you are using Drupal in a subdirectory and
70
  # the rewrite rules are not working properly.
71 72
  #RewriteBase /drupal

73
  # Rewrite old-style URLs of the form 'node.php?id=x'.
74 75 76 77
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]
78

79
  # Rewrite old-style URLs of the form 'module.php?mod=x'.
80 81 82 83 84
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

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

# $Id$