.htaccess - 301 redirect with variables

I commented out those two lines and now my 301 redirects are going from

http://www.newhair.com/treatment/fut-megasessions.asp to http://www.newhair.com/var/www/vhosts/newhair.com/httpdocs/megasessions.html (its inserting the root path into the url redirect)

and the search is still unchanged and the second link is still going to http://www.newhair.com/search/search.asp%3Fzoom_query%3Dsteve%26zoom_page%3D1%26zoom_per_page%3D10%26zoom_cat%3D-1%26zoom_and%3D0

RC,

I’ve seen that sort of thing on my test server and it’s meant that Apache needed a restart. That’s also worked on member websites when their hosts would restart, too.

It’s possible that your RewriteCond looking at the query string for a match for the key pt is far too long for Apache. I’m not sure what the line length limit is but I’d assume 255 characters, therefore, please chop that into a couple of RewriteCond statement with [OR] flags between them (NOT after the last one as you want to AND with the RewriteRule).

The other possibility is that there is a redirection to /path/to/file where Apache would first look to the server’s root directory then to your DocumentRoot.

Move the search redirection before all the others (except the domain, of course) and see whether you’ve got some intervening statement hijacking the search redirection.

Regards,

DK

Hey David! So it looks like I am down to this last item still. The search.asp page is not redirecting. I’ve tried removing all the redirects I added and just having this code below to try and redirect and no luck. Any ideas? I’ve also restarted the server and same result.

RewriteRule ^search/search\\.asp$ search.html [R=301,L]

As a second option, is it possible to have search.asp go to throw a 404 error so google ignores it and removes it from their cache?

This thread has evolved a little bit so Ive posted a new thread with just this last issue I am seeing here: http://www.sitepoint.com/forums/showthread.php?847035-modrewrite-redirect-old-search-variables

rc,

As a former TL, I’m not sure SitePoint would appreciate splitting the thread, however, I’ve already answered over there.

Since there’s nothing wrong with your code above, I’ll go back and look at the ordering of the uncommented code but I fear that there’s something you’ve not told us, i.e., you’re NOT on an Apache server or MODX does something weird (I’ve not heard anything about it).

Catch you over there (unless it’s merged onto this thread).

Regards,

DK