Sunday, September 30, 2007

Troublesome mod_rewrite

To enable the rewrite_moddule in apache is easy just do this

a2enmod rewrite

to disable it is

a2dismod rewrite

in command line after that you have to restart apache by /etc/init.d/apache2 restart. But... wait a second here ... I did all these but my Habari install was still not OK.   I have the blog and first entry correctly displayed but none of the links in the blog was working.   It must be a rewrite_rule issue, i.e. rewrite module wasn't working.    phpinfo() doesn't tell me the correct fact as well.   It was a particular apache issue with ubuntu.

I googled this (a good post here and there) and eventually found that file 000-default in /etc/apache2/sites-enabled has to be edited to set AllowOverride All    The proper way I think is to add below lines between Directory tags.


[Directory /var/www/habari/ ]
AllowOverride All
[/Directory]


where 'habari' is the subfolder where you want the mod_rewrite magic to work. I guess there are still a lot of Apache I need to know.

No comments:

Post a Comment