.htaccess 2.75 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 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
Dries's avatar
 
Dries committed
30
</IfModule>
31

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

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

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

51
# Various rewrite rules.
52 53
<IfModule mod_rewrite.c>
  RewriteEngine on
Dries's avatar
 
Dries committed
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
  #
58 59
  # If you want the site to be accessed WITH the www. only, adapt and
  # uncomment the following:
60
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
61 62
  # RewriteRule .* http://www.example.com/ [L,R=301]
  #
63 64
  # If you want the site to be accessed only WITHOUT the www. prefix, adapt
  # and uncomment the following:
65
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
66 67
  # RewriteRule .* http://example.com/ [L,R=301]

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

72
  # Rewrite old-style URLs of the form 'node.php?id=x'.
Dries's avatar
 
Dries committed
73 74 75 76
  #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
77

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

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

# $Id$