Sometimes you need to change a domain name, and you want to redirect all old pages to the new domain name.

On your existing domain, you can redirect all requests to the new domain with something like the following:

In your .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Redirect all traffic and pages to new domain
RewriteRule ^(.*)$$1 [R=301,L]

The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches, no further rules will be processed. See