mod_rewrite installed?

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

mod_rewrite installed?

Post 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...
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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 ;)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post 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 :)
Post Reply