Moving old site to a new url

Hi,

I have searched but still not understand it.
What exactly I need to do when moving a site from one url to another. So far I understand that I have to use 301 redirect . Question: is it better to use a plugin for it or is it better to put it in the functions.php? I think many of 404 errors come from broken links from old url.
Situation now is: old site redirects to the new url.

Thanks

  • Rupok

    Hi mpress,

    Thanks for asking. Actually you have to set the 301 redirection on your old URL so it doesn't harm the SEO of your site.

    Let me explain in details. Suppose previously your site URL was "www.old.com" and you have moved your site to "www.new.com". If anyone goes to "www.old.com", you should be redirecting him to "www.new.com" so your traffic is not lost. Now, how you are redirecting your users to the new site plays a big role in SEO. You can redirect in different way, but if you 301 redirect, then it tells search engine bots that your site has moved permanently to a new location and it doesn't harm your site.

    As the redirection should happen at your old URL, so you don't need to install any plugin or add any code in functions.php file in your site at the new location. But you will have to manage redirection at the old location. You can do that in many ways, using PHP, using .htaccess etc. I'm describing some here:

    # PHP 301 Redirect
    To do this, please login to your server location with FTP where the old URL is pointed. Then create a file named "index.php" and open that file. Then add the following code in that file and save:

    <?
    Header( “HTTP/1.1 301 Moved Permanently” );
    Header( “Location: http://www.new.com” );
    ?>

    Please replace "http://www.new.com" with your real new URL. This will redirect traffic coming to your old URL to your new URL.

    # .htaccess 301 Redirect [Better Approach]
    Create a .htaccess file in your root directory of your OLD domain with the following code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
    The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.new.com/$1 [R=301,L]

    Please replace "http://www.new.com" with your real new URL. This will redirect traffic coming to your old URL pages to your new URL same pages.

    I believe, these will remove your confusion. Please let us know if you still have any confusion or if you have any further query. We will be glad to help.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.