There are various reasons to redirect a domain to another or a webpage URL to another. Like if you are moving to a new domain with new website with better design and you wish to keep your old website visitor then it will be better if you make a redirect to new one. If you wish to keep all of your website traffic to a single website then redirect all of your domain to main one. If you are having some 404 error page then you should redirect all your error page to another one for better visitor experience.
So, here are some ways to redirect URL -
1 – If looking to redirect your old domain to new one then, if both of domain are on same hosting provider and if your domain hosting provider having domain redirection services then you can do it from c panel.
2- In html , redirection can be done via meta tag –
<meta http-equiv=”refresh” content=”0; url=http://www.ecomspark.com/” />
3- Another option is to show a message with a link on it to you new website.
4- You can use javascipt also to redirect webpage url –
5- In php, header function can be used to redirect a url –
header(“Location: email@example.com”, TRUE,303);
6- If you using apache server then you can also redirect a webpage or domain via .htaccess file.
- RewriteEngine On
RewriteRule ^(.*)$ http://www.ecomspark.com/$1 [L,R=301]
- “L” indicates that it’s the last instruction and “R” means redirect, and “301” means a permanent redirect.