View Single Post
  #13 (permalink)  
Old 10-15-2008, 04:24 PM
Clint1's Avatar
Clint1 Clint1 is online now
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2005
Location: Louisiana, USA
Posts: 1,275
Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9Clint1 RepRank 9
Default Re: How do you 301 redirect a dynamic URL (URL with a question mark in it)?

Quote:
Originally Posted by wige View Post
Ok, I have come to realize that the code I gave won't work for the root page of a folder (ie domain.tld/). The following code should work in all cases:

Code:
RewriteCond %{query_string} ref=pislikcs.com
RewriteRule (.*) http://www.example.com/$1? [R=301,L]
Thanks for trying, but that doesn't work. I had a few minutes spare so I tried it. This is what the resulting page is: http://www.domain.com/page_name.html/page_name.html
As you can see, the page name is duplicated! It puts a slash on the end, the duplicates the page name. I tried both of these:

RewriteCond %{query_string} ref=pislikcs.com
RewriteRule (.*) http://www.domain.com/page_name.html/$1? [R=301,L]

AND:

RewriteCond %{query_string} ref=pislikcs.com
RewriteRule (.*) /page_name.html/$1? [R=301,L]

And I also tried removing the / after "html".

BTW, there's a question mark you left out, I don't know if that matters. The invalid bad appending data is ?ref=pislikcs.com
__________________
God Bless,
-Clint
(Join Date: 2003)
Reply With Quote