Domain name jumps from www to non-www,apache and NGINX2 Solutions

Source: Internet
Author: User
Background: www jump to non-www.

Both http://www.jiutianniao.com and http://jiutianniao.com can be accessed.

However, want to redirect the www to non-www, the input is more simple, so that the search engine also treat them as the same 1 sites.

2 ways to solve the problem:

1.Apache:

Under Project Jiutianniao, create a new ". htaccess" file.

Rewriteengine on

Rewritecond%{http_host} ^www.jiutianniao.com

Rewriterule (. *) http://jiutianniao.com/$1 [r=301,l]

2 . Nginx:

server{

Panax Notoginseng server_name www.fansunion.cn;

301 return $scheme://fansunion.cn$request_uri;

39}

+ Server {

Listen 80;

server_name fansunion.cn;

43

CharSet Utf-8;

Access_log off;

51

SSI on;

Ssi_silent_errors on;

54

Location/{

Proxy_pass http://localhost:8888;

57}

58

59}

Reference: http://langui.me/2010/11/apache-www-to-non-www/
------------------------------------------------------------------------

Wuhan nine days bird-p2p network Loan system development-Internet application software development

Company official website: http://jiutianniao.com

Social quiz:Http://ask.jiutianniao.com

The above describes the domain name from the WWW to non-www,apache and NGINX2 solutions, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.