• ADADADADAD

    根域名怎么跳转301[ 建站问答 ]

    建站问答 时间:2024-12-01 19:10:11

    作者:文/会员上传

    简介:

    根域名做301跳转的方法:1.在域名服务商,将根域名解析到目标服务器ip地址。2.在nginx新建xxx.com.conf的vhost文件,内容如下:vi xxx.com.confserver {listen 80;server_name xxx.

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    根域名做301跳转的方法:

    1.在域名服务商,将根域名解析到目标服务器ip地址。

    2.在nginx新建xxx.com.conf的vhost文件,内容如下:

    vi xxx.com.conf

    server {

    listen 80;

    server_name xxx.com;

    rewrite ^(.*)$ http://www.xxx.com$1 permanent;

    }

    server {

    listen 443 ssl http2;

    server_name xxx.com;

    rewrite ^(.*)$ https://www.xxx.com$1 permanent;

    ssl_certificate certs/Nginx/1_www.xxx.com_bundle.crt;

    ssl_certificate_key certs/Nginx/2_www.xxx.com.key;#由于这两个命令的默认值已经好几次发生了改变,因此不建议显性定义,除非有需要额外定义的值

    # ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    # ssl_ciphers HIGH:!aNULL:!MD5;

    ssl_prefer_server_ciphers on;

    charset utf-8;

    access_log logs/localhost.access.log main;

    error_log logs/localhost.error.log warn;

    root html;

    index index.php index.html index.htm;

    location / {

    ……

    }

    }

    3.这样在浏览器访问xxx.com,就会自动跳转到www.xxx.com了。

    根域名怎么跳转301.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: 301跳转域名