View Single Post
  #14 (permalink)  
Old 10-15-2008, 04:34 PM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,629
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: How do you 301 redirect a dynamic URL (URL with a question mark in it)?

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)
__________________
The best way to learn anything, is to question everything.

Last edited by wige; 10-15-2008 at 04:36 PM.
Reply With Quote