Skip to content

Instantly share code, notes, and snippets.

@fernandiez
Last active April 12, 2016 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fernandiez/9ee97de71a266dceb737c16fb9bb495a to your computer and use it in GitHub Desktop.
Save fernandiez/9ee97de71a266dceb737c16fb9bb495a to your computer and use it in GitHub Desktop.
Change domain URLs from old to new domain .htaccess
# Change domain URLs from old to new domain (both domains parked on top of the same hosting)
# With www or without www
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^olddomain.com$
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>
# Change domain URLs from old to new domain (both domains parked on top of the same hosting)
# Only with www
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment