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
    Create Namespaced Classes with MooTools

    MooTools has always gotten a bit of grief for not inherently using and standardizing namespaced-based JavaScript classes like the Dojo Toolkit does.  Many developers create their classes as globals which is generally frowned up.  I mostly disagree with that stance, but each to their own.  In any event...

  • By
    9 Mind-Blowing Canvas Demos

    The <canvas> element has been a revelation for the visual experts among our ranks.  Canvas provides the means for incredible and efficient animations with the added bonus of no Flash; these developers can flash their awesome JavaScript skills instead.  Here are nine unbelievable canvas demos that...

Incredible Demos

  • By
    jQuery topLink Plugin

    Last week I released a snippet of code for MooTools that allowed you to fade in and out a "to the top" link on any page. Here's how to implement that functionality using jQuery. The XHTML A simple link. The CSS A little CSS for position and style. The jQuery...

  • By
    Introducing MooTools NextPrev

    One thing I love doing is duplicating OS functionalities. One of the things your OS allows you to do easily is move from one item to another. Most of the time you're simply trying to get to the next or the previous item.

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!