sharingsunshine
asked on
Need Regex To Handle Double Question Marks
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: http://www.abc.com/index.php?controller=product?pageid=444
Here is what it should look like: http://www.abc.com/index.php?controller=product&id_product=444
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=prod uct&id _product=4 44? [R=301,L]
RewriteCond %{QUERY_STRING} ^controller=product?pageid =444$ [NC]
RewriteRule ^/index\.php$ /index.php\?controller=pro duct&i d_product= 444? [R=301,L]
Please tell me what I am doing wrong in the regexes I have.
Thanks,
Here is a sample of the original link: http://www.abc.com/index.php?controller=product?pageid=444
Here is what it should look like: http://www.abc.com/index.php?controller=product&id_product=444
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
RewriteRule ^/index\.php$ /index.php?controller=prod
RewriteCond %{QUERY_STRING} ^controller=product?pageid
RewriteRule ^/index\.php$ /index.php\?controller=pro
Please tell me what I am doing wrong in the regexes I have.
Thanks,
Did you try escaping the ? in RewriteCond?
ASKER
I just now tried it but there was no change. So I then escaped the ? in the rewrite rule and that made no difference either.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I hope you want to redirect 404 pages only.
RewriteEngine on
ErrorDocument 404 /index.php
RewriteEngine on
ErrorDocument 404 /index.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.