简体   繁体   中英

What is the best way to do this site redirection

Have a site in which we are pointing some links to "www.example1.com".

Recently "www.example1.com" changed to "www.example2.com".

Now if we access "www.example1.com" it will automatically redirect "www.example2.com".

In "www.example.com" still it point to "www.example1.com" .

How its working now is...

www.example.com ->www.example.com- > www.example1.com->www.example2.com.

In our site all links are hard coded.

Question ?

What is the best way to do it ?

Continue to leave it like this or need to update all hard coded values.

Issue is : in future if we update this url again, we need to update code again

Please help me with some suggestions.

From the spec

10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs . Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.

So yes, if you are permanently redirecting a URL then you should update links to point to the new location.

In practical terms, this will save browsers visiting the link having to ask for the document only be to told to go away and ask for it somewhere else repeatedly in a digital kafkaesque nightmare.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM