By wxman on
I'm hoping someone that's better than I at RewriteRule can help.
I have a site that seems to have a bad link coming in from somewhere at Amazon. I keep seeing page not found errors like:
page/my-books/\
page/my-books/\/\
as well as others like these, all ending in either /\ or /\/\ . I tried several rewriterule's but none seemed to work. I just want to have it get rid of the extra /\ and redirect it to the correct pages, like page/my-books, in this example. This is just until I can find where the bad link is coming in from.
Comments
Hello, Did you enable "Clean
Hello,
Did you enable "Clean URLS" in "Administer"?
Yes I do have clean URL's on
Yes I do have clean URL's on
The issue you probably had
The issue you probably had with the rewrite rules was escaping the existing backslashes.
This should do it:
Thanks Brian, that did it.
Thanks Brian, that did it. I've never been very good at regex, and you were correct, I didn't escape them.
Thanks.
I don't suppose there is a
I don't suppose there is a trick so this would work on several different file names? For example:
/page/my-books/\
/page/more-books/\
/page/my-other-books/\
I can do a rule for each one in my log, but I think that would be inefficient. Is there a way to use a variable, like %{REQUEST_FILENAME} to replace the file name in both Cond and the Rule?
This should do
This should do it:
Any matches from the last RewrieCond get exposed in variables prefixed with %. Any matches from the RewriteRule get prefixed with $.
I hope this helps!
You are a lifesaver! I can't
You are a lifesaver! I can't tell you how many searches I did looking just for how to use a variable, but I couldn't find one that made sense. This works great now. Of course I would love to find where on Amazon the bad link is coming from, but that could take a while.
Thanks again.
I know what you mean. You're
I know what you mean. You're welcome. :)