Troublesome mod_rewrite

September 30, 2007

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: