Easily Redirect Your Entire Domain with .htaccess

Permanently moving one domain to another is a huge task. Creating a single redirect for each page on your site is unrealistic and would suck the very life from your body. Well, relax – there’s an easier way, using htaccess. This will redirect all of your pages to their respective new pages on your new domain.

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^OLDDOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://www.NEWDOMAIN.com/$1 [R=301,L]

Be sure to replace “OLDDOMAIN” with your own old domain, and “NEWDOMAIN” with your new domain.

Published by

Tim Bunch

Tim Bunch is a Web Developer from Boise, Idaho. As a web standards fanatic, he passionately pursues best practices. He also actively engages people on a wide range of topics in a variety of social media networks. Tim is also an avid Wordpress developer, music maker, coffee drinker, and child raiser. @timbunch

Leave a Reply

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