: This article describes how to redirect a domain name from www to non-www, Apache, and Nginx2. For more information about PHP tutorials, see. Background: jump from www to non-www.
Both http://www.jiutianniao.com and http://jiutianniao.com are accessible.
However, if you want to redirect www to a non-www website, the input is simpler so that search engines can treat them as the same website.
Two solutions:
1. Apache:
Create a ". htaccess" file under the project jiutianniao.
RewriteEngine On
RewriteCond % {HTTP_HOST} ^ www.jiutianniao.com
RewriteRule (. *) http://jiutianniao.com/#1 [R = 301, L]
2. Nginx:
Server {
37 server_name www.fansunion.cn;
38 return 301 $ scheme: // fansunion.cn $ request_uri;
39}
40 server {
41 listen 80;
42 server_name fansunion.cn;
43
49 charset UTF-8;
50 access_log off;
51
52 ssi on;
53 ssi_silent_errors on;
54
55 location /{
56 proxy_pass http: // localhost: 8888;
57}
58
59}
References: http://langui.me/2010/11/apache-www-to-non-www/
------------------------------------------------------------------------
Wuhan Jiutian bird-p2p online loan system development-Internet application software development
Official website: http://jiutianniao.com
Social Q & A: http://ask.jiutianniao.com
The above describes how to redirect a domain name from www to a non-www, Apache, and Nginx2 solution, including some content, and hope to help friends who are interested in PHP tutorials.