Mod Rewrite doesn't seem to be active

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
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Mod Rewrite doesn't seem to be active

Post by impulse() »

It's enabled on Apache and phpinfo() show's the module is loaded. My .htaccess file looks like this:
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1
I have also run 'chmod 777 .htaccess' to make sure it's not a permissions problem. But when I go to products.php?id=12 the URL shows exactly that and doesn't seem to rewrite. I've followed a few tutorials on mod_rewrite and nothing suggests anything to fix this problem. Can you see a reason for this with the information I have provided?

Thanks,
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Mod Rewrite doesn't seem to be active

Post by Christopher »

According to your rule it would rewrite "product12.html" to "product.php?id=12". I would also not that your are adding an "s" to "product" in your example.
(#10850)
devendra-m
Forum Contributor
Posts: 111
Joined: Wed Sep 12, 2007 3:16 am

Re: Mod Rewrite doesn't seem to be active

Post by devendra-m »

RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1
you have used dash(-) after product
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Re: Mod Rewrite doesn't seem to be active

Post by impulse() »

I thought I'd try mod_rewrite at the most basic level and here are my results.

I have a .htaccess file with the following in it:
RewriteEngine on
RewriteRule old.html new.html
And I have both old.html and new.html in the same directory. But no matter which one I goto, it shows the content of the one I've gone to. Am I missing something about mod_rewrite or does it not seem to be active from the above example?
Post Reply