Need Regex To Handle Double Question Marks

Discuss practical ways rearrange URLs using mod_rewrite.

Need Regex To Handle Double Question Marks

Postby sharingsunshine » Thu Oct 30, 2014 1:48 pm

I have several 404 links that need to be redirected. They are from an external source so I don't have the control to change the links. So I am wanting a rewrite rule for htaccess I can use.

Here is a sample of the original link:

Here is what it should look like:

This is the rewrite I am trying but it doesn't match. Neither does the other option which escapes the ? in the rewrite rule.

RewriteCond %{QUERY_STRING} ^controller=product?pageid=444$ [NC]
RewriteRule ^/index\.php$ /index.php?controller=product&id_product=444? [R=301,L]

RewriteCond %{QUERY_STRING} ^controller=product?pageid=444$ [NC]
RewriteRule ^/index\.php$ /index.php\?controller=product&id_product=444? [R=301,L]

Please tell me what I am doing wrong in the regexes I have.

Posts: 55
Joined: Tue Dec 19, 2006 5:32 am

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 2 guests