Forum Moderators: phranque

Message Too Old, No Replies

query string again

         

hanyaz

6:44 pm on Feb 19, 2011 (gmt 0)

10+ Year Member



Hello
Sorry to ask the question, i have tried to adapt many exemples without success...i would like to redirect some page of my site to the home page they all have same parameters:

search/qs.html?qsvpage=361&res=vpc&searchkey=D%E9bat

I have tried this in htaccess without success,

RewriteCond %{QUERY_STRING} ^qsvpage=(.*)(&res=)?(.*)(&)?(searchkey=)?$
RewriteRule ^(/search/qs\.html)?$ http://www.mysite.com/$1? [R=301,L]

Did i miss something ?
Thanks in advance

[edited by: jdMorgan at 4:54 pm (utc) on Mar 4, 2011]
[edit reason] Enclosed code in [ code ] tags for readability. [/edit]

g1smd

7:26 pm on Feb 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



By ending with $ you have not allowed for searchkey to have a value after the equals sign.

The multiple .* patterns will cause the rule to parse very very slowly. Change to a better pattern using [a-z]+ or [0-9]+ or similar.

Many of the parentheses and question marks are probably not needed.

Use example.com to stop the forum auto-linking the URLs in your posts.
Tick the box: "Disable graphic smile faces for this post"

jdMorgan

5:03 pm on Mar 4, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



search/qs.html?qsvpage=361&res=vpc&searchkey=D%E9bat

I have tried this in htaccess

URL-paths examined by RewriteRule in .htaccess do not start with a slash. This is the solution for redirecting requests for exactly the URL-path /search/qs.html?qsvpage=361&res=vpc&searchkey=D%E9bat to www.mysite.com/ :

RewriteCond %{QUERY_STRING} ^qsvpage=361&res=vpc&searchkey=D\%E9bat$
RewriteRule ^search/qs\.html)$ http://www.mysite.com/? [R=301,L]

Jim