This tutorial from ComputersPh.com is just for the 301 redirection, not the actual moving of the whole website (directories, subdirectories and files).
I had to move a website over the weekend to a new domain and after some hard research, I went back to my cPanel and let it handle the 301 redirecting for me anyway.
Here are the steps that I took:
In cPanel, All I have to do was click Redirects icon from my Domain box, it then took me to the redirect page.
I had 2 choices to make for the redirection type.
I chosed the 301 redirection because this is a permanent move as opposed to the 302 redirection type (302 Temporary Redirect, which is only for a temporary move).
The next step was to choose which Domain you want to move from a drop down box, pick the right domain then fill in the Redirects To box with the new Domain name (which is located right below the drop down box).
The next step was to pick the www redirection to either
1) Only redirect with www.
2) Redirect with or without a www.
2) Do not Redirect www.
I clicked the Redirect with or without a www. because the website that I was moving could be accessed with or without the www. (http://mydomain.com or http://www.mydomain.com).
There was also a tick box if you want a wildcard Redirect in which I left blank.
A Note below the tick box states that:
Checking the Wild Card Redirect Box will redirect all files within a directory to the same filename in the redirected directory.
You cannot use a Wild Card Redirect to redirect your main domain to a different directory on your site.
I then pressed the Add button and that’s all there is to it. The website has now been redirected to the new domain.
What actually happened is that your .htaccess file was updated with your new website and the change should look similar to this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^oldwebsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.oldwebsite.com$
RewriteRule ^.*$ “http\:\/\/www\.newwebsite\.com” [R=301,L]
The last step is to make sure that you test your website after the move. Just type in the old website in your browser, it should take you to the new domain seemlessly without you doing anything else.
Note* This method of redirection using .htaccess file works on Linux servers only with the Mod-Rewrite module rule enabled in Apache.
Below is a list of other articles that may interest you: