0

This is how my apache httpd file looks like:

LoadModule rewrite_module modules/mod_rewrite.so <Directory / > Options FollowSymLinks AllowOverride ALL Order allow,deny allow from all </Directory> 

Now i try to execute this simple mod rule:

RewriteEngine on RewriteRule ^product-([0-9]+)\.html$ index.php?id=$1 

This rewrite should happen when i press this link:

 <a href="product-91.html">Press me</a> 

1 Answer 1

1

if you put your rewrite rule in the apache config you will need a leading / after the ^(not needed for htaccess). Try the rule with out ^ to see if it matches. I have also had some servers/vhosts where I needed to add RewriteBase rewrite would work.

Sign up to request clarification or add additional context in comments.

2 Comments

That has worked. very strange..why did the ^ interfer? or was it the RewriteBAse that did the job
If you have time you might want to try playing around with both. ^ is start of string. You can try replacing ^ with ^/ to see if that works.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.