Reputation: 927
i am trying to rewrite a URL for SEO purpose.
The old URL is:
http://www.example.com/recipe_local.php?hl_cusine=1
The new URL should be like bellow and automatic redirect to this url if user come above url
http://www.example.com/recipes/healthy-recipes
My Code in the .htaccess is:
RewriteEngine on
RewriteRule ^recipes/healthy-recipes/$ recipe_local.php?hl_cusine=$1 [NC,L]
RewriteRule ^recipes/healthy-recipes$ recipe_local.php?hl_cusine=$1 [NC,L]
Even after hours of research, i have no clue why this is not working :(
Upvotes: 0
Views: 682
Reputation: 3398
The $1
in your rewrite is pointing to a backreference you never capture.
Unless you have a RewriteCond
you are not showing?
try:
RewriteEngine on
RewriteRule ^recipes/healthy-recipes/$ recipe_local.php?hl_cusine=1 [NC,L]
RewriteRule ^recipes/healthy-recipes$ recipe_local.php?hl_cusine=1 [NC,L]
Upvotes: 1