Preventing Broken Links

TL;DR: If you’re going to move to a new URL, fill out my templates and put them at the old one to make damn sure other people’s links don’t break.

Yesterday, I finally found a use for the root domain… I delegated it to GitHub to shorten and professionalize URLs for my projects. (eg.

…but that meant that I could no longer use .htaccess to set up permanent redirects on URLs like

After a little research, it turns out that GitHub Pages doesn’t seem to have a method of declaring HTTP redirects… but Google and Yahoo will treat no-delay meta redirects as if they were HTTP 301.

Here’s what I came up with for a general, thorough way to ensure the least chance of broken links. (including .htaccess in case I switch hosting in the future) The example assumes you’re moving a whole domain (eg. from SourceForge to GitHub), but it applies equally well to specific URLs within a domain.

(Also, don’t forget to use the change-of-address notification feature in Yahoo and Google Webmaster Tools)

CC BY-SA 4.0 Preventing Broken Links by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

One Response to Preventing Broken Links

  1. Diana Anderson says:

    Thanks for the step by step process. This really helps! I have been lost for a while now.

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.       Also, please be aware that non-constructive comments will have their URL field erased before being approved in order to combat SEO spam.