Reputation: 181
I need to REDIRECT (not just rewrite) from:
example.com/home/?s=keyword
to:
example.com/search/keyword
Currently I am trying to use the following:
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "http\:\/\/www\.example\.com\/home\/" [R=301,L]
RewriteCond %{QUERY_STRING} ^/s=(.*)$
RewriteRule ^(.*?)$ search/$1 [NC,R,L]
I know it is wrong but I have no idea how to fix it...
Upvotes: 0
Views: 47
Reputation: 143876
try:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule ^/?$ http://www.example.com/home/ [R=301,L]
RewriteCond %{THE_REQUEST} \ /+home/?\?s=([^&\ ]+)
RewriteRule ^home/?$ /search/%1? [L,R]
RewriteRule ^search/(.+)$ /home/?s=$1 [L]
Upvotes: 1