Click to See Complete Forum and Search --> : What's wrong with my .htaccess file?


smith.norton
09-03-2006, 04:55 AM
I did the following things.

In the 'httpd.conf' file, I enable mod_rewrite. Here is the relevant portion of the file:-

#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so

I created a .htaccess file in my Document root. I am dumping the complete content of the .htaccess file.

RewriteEngine on
RewriteRule ^old\.php$ index.php

That's the complete file. I am a n00b in .htaccess. I may be wrong with this.

Then when I try to access http://localhost/old.php I get an error message. I was expecting http://localhost/index.php to appear.

Can anyone tell me what might have gone wrong?

pcthug
09-03-2006, 05:20 AM
Do not double post. Your other post has been removed.

ray326
09-03-2006, 02:58 PM
http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

Your regx says the pattern contains ONLY "old.php" but the URL doesn't.

smith.norton
09-04-2006, 05:00 AM
Thanks for the replies.
RewriteEngine on
RewriteRule ^/old\.php$ index.php

I tried this in the httpd.conf file and it works perfectly well. But the same thing doesn't work when I put the above thing in .htaccess

Do I have to mention something in httpd.conf to tell the Apache Server that it should check the .htaccess file too? (May be Apache doesn't look for .htaccess by default to improve performance. Just guessing!!)

I am a n00b with Apache, so I need a little guidance.

Thanks in advance!

ray326
09-04-2006, 01:59 PM
In the conf file you have to allow overrides on the directories where you want to use htaccess. It doesn't look for it by default because it's a security threat.