.htaccess 2.42 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
# Requires mod_expires to be enabled.
47
<IfModule mod_expires.c>
48 49 50 51 52
  # Enable expirations.
  ExpiresActive On
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
  # Do not cache dynamically generated pages.
53 54 55
  ExpiresByType text/html A1
</IfModule>

56
# Various rewrite rules.
57 58
<IfModule mod_rewrite.c>
  RewriteEngine on
Dries's avatar
 
Dries committed
59

60 61
  # 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:
62
  #
63 64
  # If you want the site to be accessed WITH the www. only, adapt and
  # uncomment the following:
65
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
66 67
  # RewriteRule .* http://www.example.com/ [L,R=301]
  #
68 69
  # If you want the site to be accessed only WITHOUT the www. prefix, adapt
  # and uncomment the following:
70
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
71 72
  # RewriteRule .* http://example.com/ [L,R=301]

73
  # Modify the RewriteBase if you are using Drupal in a subdirectory and
74
  # the rewrite rules are not working properly.
Dries's avatar
Dries committed
75 76
  #RewriteBase /drupal

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$