Page 1 of 1

mod_rewrite installed?

Posted: Fri Nov 30, 2007 11:34 pm
by alex.barylski
Edit: I am quite sure it's mod_rewrite not properly installed or loaded as I just tried some working .htaccess files and they are not working either...I'm going to reboot my system not just the server and see if that makes a difference...&^Q#%%$^ :?

I have searched Google and treied the following:

First I checked the debian mods-enabled directory. Nothing there, so i install it using:

Code: Select all

a2enmod rewrite
I follow that with the force-reload switch

Then I restart Apache.

I try again using this rewrite code:

Code: Select all

RewriteEngine on
RewriteRule proxy.html proxy.php
proxy.php exists but proxy.html doesn't. When I enter:

Code: Select all

http://192.168.1.103/myprog/uploads/proxy.html
I get a friggen 404.

The .htaccess file resides inside the 'uploads' directory as does the 'proxy.php' file.

How do I confirm whether mod_rewrite is working? It's available in the mods-enabled directory what more do I have to do...

Posted: Sat Dec 01, 2007 12:14 am
by John Cartwright
If you include a

Code: Select all

RewriteEngine on
without the module enabled you will get a HTTP-500 error, Internal Server Error I believe.

Code: Select all

RewriteEngine on

RewriteBase /myprog/uploads/
RewriteRule proxy.html proxy.php
Works fine for me ;)

Posted: Sat Dec 01, 2007 12:32 am
by alex.barylski
Everything worked fine in Debian Sarge I haven't used mod_rewrite in about 3 months (since I switched over to Etch).

What changed is that the http configuration file on Debian Etch (/mods-enabled/000-default) needs to have the AllowOverride setting set to All.

Prior to this, I followed what most articles tell you too:

1) Run a2enmod rewrite
2) /etc/init.d/apache2 force-reload
3) apache2ctl force-reload

However when I tried to test my mod_rewrite code I was getting a 404 error. Turns out the reason was because the AllowOverride setting defaults to None so your .htaccess files are ignored. Resetting that value to All and invokking apache2ctl restart did the trick.

Everything works as expected now... :D

Hopefully this saves someone the greif I was going through as I've installed mod_rewrite about a dozen times but never had this problem so I figured something was up...PITA...

Cheers :)