thijs321
asked on
RewriteRule in .htaccess isn't working properly, how can this be fixed?
We've made some changes to the website including several url's. Since some other websites haven't updated their forms/url's yet they are linking to the wrong page. We've come up with the RewriteRule you can find in the Code Snippet, but it's not working at all.
Url at the old website:
http://website.com/search/?keywords=[...]
or
http://website.com/search/?keywords=[...]&place=[...]
And most of the time it has &button=Search at the end of it.
It needs to be rewrited to:
search.php?s=[keywords]&p= [place].
Url at the old website:
http://website.com/search/?keywords=[...]
or
http://website.com/search/?keywords=[...]&place=[...]
And most of the time it has &button=Search at the end of it.
It needs to be rewrited to:
search.php?s=[keywords]&p=
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^search/\?keywords=([^&]*)(?:&place=([^&]*))?.*$ search.php?s=$1&p=$2 [R=301,NC]
# Some other rules.
# ...
</IfModule>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window