Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite woes.

Unable to get mod_rewrite working with apache

         

shabda

3:02 am on Aug 19, 2007 (gmt 0)

10+ Year Member



I want to set up mod_rewrite to work with apache. So I installed apache on my box. Since these days apache comes with mod_rewrite installed by default, I thought I would not have to make any changes to apache to get it working, but for some reason mod_rewrite is not working.
My apache version is "Apache version 2.0.59"
1. I have the following lines present my httpd.conf
Code:

LoadModule rewrite_module modules/mod_rewrite.so

2. modules/mod_rewrite.so is available on my system.
3. To test mod rewrite I created a .htacces file under /var/www/html/test/
with the following lines
Code:

RewriteEngine On
RewriteRule ^check\.php$ /phpinfo.php [L]

I have the file /var/www/html/phpinfo.php present. Now trying to access the page at www.example.com/test/check.php gives a 404 error while www.example.com/phpinfo.php gets me the required page.
So mod_rewrite is not working.

Hrrmff!

g1smd

4:34 pm on Aug 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your check URL calls for check.php in the /test/ folder.

The rewrite rule only allows for the check.php to be in the root.

jdMorgan

11:29 pm on Aug 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The code should work, because the .htaccess file is in /test...
> 3. To test mod rewrite I created a .htaccess file under /var/www/html/test/
As such, the URL-path would be localized to "check.php" when this code looked at it.

Make sure you have the proper AllowOverrides and Options settings needed to enable mod_rewrite.

Jim

g1smd

12:24 am on Aug 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I based my answer on the stupid stuff that I normally do when I am testing things like this. :-)

I missed the obvious, again.