[support] Clean URL's

Rob Wilmshurst drupal at fifteenoclock.com
Fri Jul 13 23:19:23 UTC 2007


Glad I could help.  Should probably have explained what it does:

> RewriteEngine On
Turns on mod_rewrite (providing it's been enabled in the apache  
configuration)
> RewriteCond %{REQUEST_FILENAME} !-f
If the request is not for an existing file...
> RewriteCond %{REQUEST_FILENAME} !-d
... or for an existing directory..
> RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
...then redirect everything to 'index.php' in the current folder,  
assigning the requested url to the 'q' variable.
The [L,QSA] part tells mod_rewrite to skip any remaining rules (L for  
Last) and append a querystring, if any.

I'd recommend you take a look at the .htaccess from a default Drupal  
install; it's got a few extra rules that help with security (eg  
preventing access to .module files).

Cheers,
Rob

--
Rob Wilmshurst
rob at fifteenoclock.com


More information about the support mailing list