Skip to content

How to redirect all pages and or URLs from old domain to your new domain

If you ever get a new domain, and you want to redirect all the traffic going from the old domain to your new domain, you can do this simple .htaccess trick.

Log into your cPanel, and into file manager.  Go into your public_html folder.  You should see the file .htacess.  If you do not, then it may be hidden.  On the top right-hand corner is the settings button.  Click on that to show hidden files.  If it still does not show up, then you can just create a new file and call it .htacess  (that is dot in front of htaccess)

Open up that file and add the text below

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^olddomain.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/ [R=301,L]

If you want all the traffic to go to a certain page or URL use the code below

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^olddomain.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/folder/ [R=301,L]

Be sure to change the text in Red to your domain and URLS you want to use