Categories
Web Development

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]
</IfModule>

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

By Tim Bunch

Tim Bunch is a Web Developer from Rockaway Beach, Oregon. 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