Change Domains But Keep Your Traffic – .htaccess 301s

By  on  

Changing domains was a big decision. My biggest concern was being able to keep my user, RSS feed, and search engine traffic. Luckily, the power of the .htaccess file allowed me to do so:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://yournewdomain.com/$1 [R=301,L]

The above .htaccess file code, placed on the old domain, redirects the user to the same URL on the different domain.
Quick, easy, and functional.

Recent Features

  • By
    5 HTML5 APIs You Didn’t Know Existed

    When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It."  Can you blame us though?  We watched the fundamental APIs stagnate for so long that a basic feature...

  • By
    5 Awesome New Mozilla Technologies You’ve Never Heard Of

    My trip to Mozilla Summit 2013 was incredible.  I've spent so much time focusing on my project that I had lost sight of all of the great work Mozillians were putting out.  MozSummit provided the perfect reminder of how brilliant my colleagues are and how much...

Incredible Demos

Discussion

  1. One more note. I recommend keeping your old domain for at least a year. Make sure to give users and search engines time to update.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!