Community Support
December 01, 2008, 02:59:44 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Staff List Login Register  
Pages: [1]
  Print  
Author Topic: Drupal: Clean URLs (.htaccess)  (Read 59 times)
Andrew
Byteact/i.create Administrator
Administrator
*****
Offline Offline

Hosting Plan: Premium Hosting
Operating System: Linux
Browser: Opera
Posts: 86
Referrals: 2


« on: July 01, 2008, 07:25:21 PM »

In order for Drupal's Clean URLs to work, replace the .htaccess file created with the following:

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

# Set some options.
Options -Indexes
Options +FollowSymLinks

# Set the default handler.
DirectoryIndex index.php

  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0

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

  <IfModule mod_mime.c>
  AddCharset utf-8 .html
  </IfModule>

  RewriteCond %{REQUEST_URI} !^/cache
  RewriteCond %{REQUEST_URI} !^/user/login
  RewriteCond %{REQUEST_URI} !^/admin
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{QUERY_STRING} ^$
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI} -d
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI}/index.html -f
  RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1/index.html [L]
  RewriteCond %{REQUEST_URI} !^/cache
  RewriteCond %{REQUEST_URI} !^/user/login
  RewriteCond %{REQUEST_URI} !^/admin
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{QUERY_STRING} ^$
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI}.html -f
  RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1.html [L]
  # BOOST END

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Logged

Unsolicited private messages for support issues will go unanswered
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC | Sitemap | Archive Valid XHTML 1.0! Valid CSS!