Nothing is wrong with the code if you want requests for this URL (with or without www, and with or without query strings):
to be redirectly to
and original query string (if present) reattached.
Is that your actual, literal code or are you paraphrasing? It may help to give some real-life examples. Using example.com, of course, and showing captures, if any.
I was using fake domain/category/keyword names.
I have them working now except for one line of redirects that takes down the whole site and I can't see anything wrong with it. I"ve checked and double checked the old/new files and the spelling is correct. I even retyped the rule to make sure there wasn't strange code in it.
Can someone tell me why this line takes out the whole website? I only changed the domain on this one:
I get an "internal server error" when this line is in there but everything works fine if I take it back out.
Use the Live HTTP Headers extension for Firefox to see if anything else is returned before the server error occurs.
Ok, did that. Here is the result after putting that line (a 301 redirect from old page to new) back in htaccess just long enough to test this. Can you tell what's wrong?
GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept-Encoding: gzip, deflate
Cookie: __utma=106706774.1114373890.1344777249.1344777249.1344777249.1; __utmz=106706774.1344777249.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
HTTP/1.1 500 Internal Server Error
Date: Sun, 12 Aug 2012 16:37:13 GMT
Content-Type: text/html; charset=iso-8859-1
There's not an external redirect loop, so there's likely an internal rewrite loop.
I have several similar redirects renaming files and a handful of 410's and the usual non-www to www for the domain which is last in the list.
Everything works fine except this one redirect. If I put it in the whole site goes down. I checked each of the other redirects one by one and they work fine. This is on a new host too.
Any suggestions as to what I should look for that could be causing a loop?
I copied & pasted into a text editor, selected Show Invisible characters and got
with a hard line break in the middle and a trailing space (LETHAL!) at the end. Are either of those in your real Rewrite, or are they artifacts of your own cut-and-paste into the Forums post?
That must have been it as it's working now.