Forum Topic: Trouble with 301’s & and %
I am having trouble with a 301 redirect with a
% in it. The url is:
I have this in my .htaccess file:
Redirect permanent /inmotion-rev­%3Biew/ http://example.com/inmotion-review/
I’m sure its the
% that are in the url. Wasn’t ever a page on my site, but somewhere somehow there is link pointing to me or Google is crawling that url for some reason.
8 Replies to “Trouble with 301’s & and %”
In my experience you should not encourage rogue links, especially when the URL format does not match currently existing.
That said, it should be possible to catch the
% with RedirectMatch, for example:
RedirectMatch 301 \\%3 http://example.com/
The first slash escapes the second slash which escapes the percent symbol. So for example, something like this should work:
RedirectMatch 301 shy\\%3Biew / http://example.com/inmotion-review/
Getting back to my comment about ignoring rogue links, I would do a 410 Gone instead:
RedirectMatch 410 /inmotion-rev­\\%3Biew/
That will help weed out the ill request and focus bots on legit URL patterns.
I hope this helps.
Thanks Jeff, I will have to put it in correctly. I have a couple more problem urls, but will sort them out in 2-3 days.
I tried both of those. The 301 didn’t redirect the site and the 410 just broke the site with an internal 500 error. Any ideas?
Sounds like something else is happening, like maybe other rules are interfering..? I don’t know, but you may try changing RedirectMatch to just Redirect in the 410 rule, not sure if RedirectMatch works with 410 or not (off the top of my head).
Yeah I tried it with “Redirect permanent” still no luck. I have 6 errors in WMT, they are similar with the
% in them.
Not sure then, could be some other rules that are interfering, or even a script doing something with traffic. Also could check if mod_rewrite and mod_alias are enabled on the server.
Ok thanks I might have to contact InMotion support and ask them about that. Just these couple urls and I am good. Oddly enough the url is redirecting to a URL that reviews their company LOL.
Yeah that’s weird.. definitely ask about it, keeping in mind that what you are trying to do with .htaccess is basic redirecting, which should be straightforward on any Apache server. Good luck!