.htaccess 2.63 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|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root)$">
7 8
  Order deny,allow
  Deny from all
9
</FilesMatch>
Dries's avatar
 
Dries committed
10

11
# Set some options.
12
Options -Indexes
13
Options +FollowSymLinks
Dries's avatar
 
Dries committed
14

15
# Customized error messages.
Dries's avatar
 
Dries committed
16 17
ErrorDocument 404 /index.php

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

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

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

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

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

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

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

54 55 56
  # 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:
  #
57
  # If you want the site to be accessed WITH the www. only, adapt and uncomment the following:
58 59 60
  # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
  # RewriteRule .* http://www.example.com/ [L,R=301]
  #
61
  # If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following:
62 63 64 65
  # RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  # RewriteRule .* http://example.com/ [L,R=301]


66
  # Modify the RewriteBase if you are using Drupal in a subdirectory and
67
  # the rewrite rules are not working properly.
Dries's avatar
Dries committed
68 69
  #RewriteBase /drupal

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

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

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

# $Id$