Configure Apache url-rewrite module for clean urls

Objective: get url-rewrite module for apache to work to render beautiful queries:

http:/www.yourwebsite.com/article/add/story
(to be compared to www.yourwebsite.com?q=article...)

step 1: check if mod_rewrite is activated
The command "apachectl -M" or "apache2ctl -M" (depending on linux distro) will list all activated modules.

step 2: activate the module
On ubuntu distro, if the module is not activated, just cd to the /etc/apache2/mods-enabled directory and add a link to the "rewrite.load" file that should be available in your mods-available directory.
ln -s ../mods-available/rewrite.load rewrite.load then reload apache and check that your module is activated (step1)

step 3: inside sites-available dir (for ubuntu), add a Directory directive with the AllowOverride variable set to All.



Options Indexes FollowSymLinks MultiViews
------> AllowOverride All
Order allow,deny
allow from all




this should be ok, url rewrite scripts should work within the directory specified in the directive.

Commentaires