For example, if you visit xxx.cn, it will jump to xxx.com. Where should you set it?
大家讲道理2017-05-27 17:42:00
A:Go to the domain name resolution office to set up. Wanwang calls it "explicit URL". Explicit URL:
Point the domain name to an http(s) protocol address. When accessing the domain name, it will automatically jump to the target address (for example: after explicitly forwarding www.net.cn to www.hichina.com, access www.net .cn, the address displayed in the address bar is: www.hichina.com).
B:Set up domain name redirection in Apache or Nginx. Keyword, "Nginx domain name redirection".
C:Judge jump in the code.
Choose one of three.
给我你的怀抱2017-05-27 17:42:00
Well, there are three options, suitable for different situations.
If you are an independent WebServer, you can configure the jump in the WebServer configuration. Common jump status codes are 301 (permanent, the jump result will be cached by the browser for at least 24 hours) and 302 (temporary, jump The transfer results will be cached by the browser for at least 10 minutes).
For example, you can use nginx’s conf or Apache’s
.htaccess
configuration. Related configurations can be found using the search engine.
If your domain name is registered and is using a domestic smart DNS service , such as CloudXNS or DNSPod, you can configure a resolution record with explicit jump.
Place a index.php
或者 index.html
under the domain name you need to jump to. The former can use php to achieve 301 302 jump, and the latter can use html with js to jump to 301 302.
Note that using js to jump may be judged as a violation by the search engine and the authority will be demoted. It may even be judged as a dangerous webpage with malicious jumps.