Web Hosting Talk







View Full Version : mod_rewrite


WLHosting
10-21-2005, 09:11 PM
I am trying to develop some scripts/sites on a test server that is in my apartment. I am running Red Hat Fedora 3, Apache 2.0.53, php 4.3.11.

I have looked in the phpinfo() and it says that mod_rewrite is enabled in the Loaded Modules section.

I have created an .htaccess file and included the following:
RewriteEngine on
RewriteBase /
RewriteRule ^/test$ /index.php?p=test

This is just for testing purposes. I have been trying to pick apart some .htaccess files on working sites that I have that use mod_rewrite.

All files are located in the root directory of the web server. And there is a file called index.php in there.

Any suggestions on what could be causing the issues of getting a 404 if I try going to /test from the root directory?

Thanks!

Burhan
10-22-2005, 03:44 AM
remove the / from your rule.

WLHosting
10-24-2005, 10:25 AM
I tried to remove the RewriteBase / and that had no affect. Then I tried removing the /'s in the RewriteRule and that had no affect either.

Is there any command that I may have to run or configurations that I have to check on the server to try make sure that mod_rewrite is actually working?

FalseDawn
10-24-2005, 10:51 AM
RewriteRule ^test$ index.php?p=test

Burhan
10-24-2005, 12:54 PM
Make sure AllowOverride is enabled for your directory. It may be that your .htaccess file is not being read by the server.

WLHosting
10-24-2005, 03:50 PM
Thank you fyrestrtr. That was my problem. Everything works great now. Thanks!