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
    Conquering Impostor Syndrome

    Two years ago I documented my struggles with Imposter Syndrome and the response was immense.  I received messages of support and commiseration from new web developers, veteran engineers, and even persons of all experience levels in other professions.  I've even caught myself reading the post...

  • By
    Create a CSS Cube

    CSS cubes really showcase what CSS has become over the years, evolving from simple color and dimension directives to a language capable of creating deep, creative visuals.  Add animation and you've got something really neat.  Unfortunately each CSS cube tutorial I've read is a bit...

Incredible Demos

  • By
    Send Email Notifications for Broken Images Using MooTools AJAX

    One of the little known JavaScript events is the image onError event. This event is triggered when an image 404's out because it doesn't exist. Broken images can make your website look unprofessional and it's important to fix broken images as soon as possible.

  • By
    Animated Progress Bars Using MooTools: dwProgressBar

    I love progress bars. It's important that I know roughly what percentage of a task is complete. I've created a highly customizable MooTools progress bar class that animates to the desired percentage. The Moo-Generated XHTML This DIV structure is extremely simple and can be controlled...

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!