How to redirect the domain name?
With .htaccess (on the Apache server)
All pages will be redirected to new files with the same name but with a different domain:
RewriteEngine on ErrorDocument 404 /index.php Redirect 301 / http://www.scriptol.fr/
Replace scriptol.fr with the name of your new domain.
To redirect a domain name on a site without any condition one can use the following code in the index.php file:
<?php header("Status: 301 Moved Permanently"); header("Location:http://www.scriptol.com/"); ?>
For the visitor it is as if he had typed the URL of the destination site.
It is the default, so it is not required to set a status:
<?php header("Location:http://www.scriptol.com/"); ?>
How long should I leave the redirect on the old domain?
This serves to search engines, but also to visitors who are led through links on the old domain.
For them, the redirection should remain until all the links are updated, which can take years.
For search engines, the command site: allows to verify all the pages are indexed on the new domain