Welcome to WebmasterWorld Guest from 23.22.140.143

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Can you redirect linking mistakes with .htaccess?

Like periods at the end of links from other sites

     
7:48 pm on Jan 2, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 18, 2002
posts:2283
votes: 3


I regularly review my 404 errors and I notice that most of them are from errors in links from other sites. The most common example would be when they link to my site, but the link is at the end of a sentance and the period gets tossed into the link as well.
e.g.
good = http://www.example.com/category/cool-widgets.php
bad = http://www.example.com/category/cool-widgets.php.

Can I make a general rule in the .htaccess that would fix errors like this as they happen (rather than 1 at a time like I do now) and what would that look like?
7:50 pm on Jan 2, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Yes, you can easily add rules for the most common typos - trailing period, comma, semi-colon and quote.

These rules must be early in the htaccess file, long before the non-www/www redirect but after any rules that block access to malicious requests.
9:15 pm on Jan 2, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12708
votes: 244


... and keep that as a reminder to always check any links you yourself put up. Even if you've just come from the page and pasted directly from your address bar and you know it's the right URL. As in: [webmasterworld.com...] (Moderators! Don't fix that. I was illustrating the point ;))
3:04 pm on Jan 7, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 18, 2002
posts:2283
votes: 3


Awesome, thank you for the help. :)