DEV Community

Discussion on: What's the proper way to move website to a new address?

Collapse
 
ajnasz profile image
Lajos Koszti

Of course, a more sophisticated way would be to use JavaScript with location.replace.

No

Collapse
 
simme profile image
Simme

As this is posted under #help, some additional context or motivation might be useful.

Collapse
 
ajnasz profile image
Lajos Koszti
  1. webserver and dns configuration: If you have a new domain, change the old domain's DNS and create a CNAME to your new domain and use http redirection to the new domain if the server name is the old server name
  2. webserver configuration: If the dns didn't change (only the path to the file) or you can't change it, configure the web server to redirect to the new url with http code.
  3. If you don't have access to the webserver, use http meta header like in the post, and/or/rather give a link for the user that he goes to the new address. You can also add dns prefetch meta header to the html, that will speed up the redirection.
  4. JavavScript has nothing to do with it.