The situation we encountered is this: if the user enters abc.com, but our server is actually at www.abc.com, a cross-domain error will occur.
I saw that JD.com will automatically change the address to www. For example, if JD.com enters jd.com, the address displayed by the browser will automatically become www.jd.com. How is this done?
I only know about domain name resolution, but I want to say that there are three types of domain name resolution in Alibaba Cloud that seem to be able to do it: cname, explicit URL, and implicit URL. Which one should it be? And what are the differences between these three.
In addition, we also have a domain name cde.com, which has been abandoned due to historical reasons, but we want users to jump to www.abc.com when they visit cde.com. What should we do?
The situation we encountered is this: if the user enters abc.com, but our server is actually at www.abc.com, a cross-domain error will occur.
I saw that JD.com will automatically change the address to www. For example, if JD.com enters jd.com, the address displayed by the browser will automatically become www.jd.com. How is this done?
I only know about domain name resolution, but I want to say that there are three types of domain name resolution in Alibaba Cloud that seem to be able to do it: cname, explicit URL, and implicit URL. Which one should it be? And what are the differences between these three.
In addition, we also have a domain name cde.com, which has been abandoned due to historical reasons, but we want users to jump to www.abc.com when they visit cde.com. What should we do?
Make a 301 jump on the web server, nginx example:
<code class="nginx">server { listen 80; server_name abc.com cde.com; location / { return 301 http://www.abc.com$request_uri; } }</code>
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://yoururl/");
php code implementation
Do you know 301 permanent redirection? This is to solve the user access problem. cname is the ip resolved by address B and is provided to address a for redirected access.
The explicit URL means that the address bar will become invisible when jumping. The URL is the address bar when jumping. The address is still a.b.c. The way to do this is actually the iframe framework
Set up 301 redirect
Use 301 permanent redirect which is friendly to crawlers