views:

201

answers:

1

Before I begin, let me just say that I know my question is almost identical to this one.

The difference is that, while I am trying to use a RewriteCond to identify a specific parameter in the query and redirect appropriately, I do not want the query string appended to the resulting URL.

Here's what I'm trying to do in my .htaccess file:

RewriteCond %{QUERY_STRING} d=i1013
RewriteRule subpages/view.php http://www.newdomain.com/

Except when I go to www.example.com/subpages/view.php?d=i1013, it redirects to www.newdomain.com/?d=i1013 and I want it to redirect to just www.newdomain.com

What am I missing here? I thought that the query string would be appended if I typed www.bing.com/$1, but I'm not, I'm leaving it off. Thanks for your ideas!

+1  A: 

Use "http://www.newdomain.com/?" without the qsappend flag (which is the default). The empty query string replaces the original.

RewriteRule subpages/view.php http://www.newdomain.com/?

(And ServerFault seems a better place to ask this question, but don't do anything yourself at this point, it should soon enough be migrated there.)

Roger Pate
Exactly what I needed, thanks!
Jen