View Single Post
  #22 (permalink)  
Old 10-25-2008, 10:58 AM
Clint1's Avatar
Clint1 Clint1 is offline
WebProWorld 1,000+ Club
WebProWorld MVP
 
Join Date: Jun 2005
Location: Louisiana, USA
Posts: 1,277
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
The question mark should be removed from the first line, as the QUERY_STRING variable only contains what is after the question mark.

If the first one is causing duplication, I would check what other rewrite rules you have enabled, because what may be happening is that two conflicting rewrites are happening. Make sure those two lines are the first thing in the .htaccess file, after any RewriteEngine on directive. The L at the end will ensure that no other rewrites are processed after it.

EDIT: I see what the problem is. The first version has the page name stated explicitly. Change the first one from this:

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

to this:

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

(removing the bolded part)
Thanks again, but I'm sorry to say that too did not work.

Now regarding what could be causing these suggestions NOT to work:

I have "Hot Link Protection" enabled, and these redirects:

---------------------
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html
RewriteRule ^index\.html$ http://www.domain.com/ [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]

-----------------------

That first one is because (guess who) was hitting on my homepage and putting an "index.html" page on it and calling it duplicate content! So I was forced to create that redirect thanks again to G. The second is just a non-www to www version redirect. Then these:

---------------------
Options +FollowSymLinks
Options +SymlinksIfOwnerMatch

RewriteBase /
RewriteRule ^pc-cillin/(.*)
http://www. trendmicro .com/vinfo/virusencyclo/default.asp

Options +FollowSymLinks
Options +SymlinksIfOwnerMatch

RewriteBase /
RewriteRule ^vinfo/(.*)
http://www. trendmicro .com/vinfo/virusencyclo/default.asp

----------------------------------

I had to create those because (once again, GUESS WHO!) was putting MY domain as the Trend Micro domain on numerous Trend Micro SUB-pages when the Gbot would spider my virus info pages which have a feed on them from Trend.

Then I have few redirects for old URL's done via cPanel to new URL's that are similar to this:

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^OldPage.html$ "http\:\/\/www\.domain\.com\/New_Page\.html" [R=301,L]


Now that may be the problem because that is the URL that's been affected by this ?ref=pislikcs.com problem! Now if that is the cause, then how can that redirect be Incorporated into the new one I now need?

I also have some IP Deny's listed in the htaccess file, but I'm sure that wouldn't affect anything. Also, should the "RewriteEngine on" be at the VERY TOP of the htaccess file, or does it matter? It used to be right before the redirects began in the file, but recently "it moved" for some reason to the very top ABOVE the IP's listed for the IP Deny area. I have since put it back below the "IP Deny" IP's listed and right before the first redirect.
Thanks.

EDIT: I HATE the way this website screws up URL's and creates text links for them! So this time I had to go and put spaces in the Trend Micro URL's so they could be seen!
__________________
God Bless,
-Clint
(Join Date: 2003)

Last edited by Clint1; 10-25-2008 at 11:00 AM. Reason: noted
Reply With Quote