当前位置:首页 > 域名主机相关 > 正文内容

nginx使用301重定向单个网页重定向样本

oozj7年前 (2017-09-12)域名主机相关3626
server {
        listen       80;
        root /www/web/silvfilter_com/public_html;
        server_name silvfilter.com;
        return      301 https://silvfilter.com$request_uri;  
        index  index.html index.php index.htm;

        error_page  400 /errpage/400.html;
        error_page  403 /errpage/403.html;
        error_page  404 /errpage/404.html;
        error_page  503 /errpage/503.html;
        location ~ \.php(.*)$ {
                fastcgi_pass  unix:/tmp/php-56-cgi.sock;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
                fastcgi_param PATH_INFO $2;
                include fcgi.conf;
        }
        location ~ /\.ht {
                deny  all;
        }
        location / {
                 try_files $uri $uri/ /?$args;
        }
}

server {
        listen       443;
        root /www/web/silvfilter_com/public_html;
        ssl                  on;
        ssl_certificate      cert/silvfilter.com.crt;
        ssl_certificate_key  cert/silvfilter.com.key;
        ssl_prefer_server_ciphers on;
        ssl_session_timeout 10m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
        server_name silvfilter.com;
        index  index.html index.php index.htm;
        error_page  400 /errpage/400.html;
        error_page  403 /errpage/403.html;
        error_page  404 /errpage/404.html;
        error_page  503 /errpage/503.html;
        if ($request_uri = /product/html/?85.html ) { return 301 https://silvfilter.com/daishi/15.html; }
        if ($request_uri = /news/class/?95.html ) { return 301 https://silvfilter.com/Industry/; }
        if ($request_uri = /page/contact/ ) { return 301 https://silvfilter.com/liuyan.html; }
        if ($request_uri = /job/html/?4.html ) { return 301 https://silvfilter.com/zhaopin.html; }
        if ($request_uri = /product/html/?84.html ) { return 301 https://silvfilter.com/daishi/17.html; }
        if ($request_uri = /product/html/?94.html ) { return 301 https://silvfilter.com/daishi/18.html; }
        if ($request_uri = /photo/index.php ) { return 301 https://silvfilter.com/photo/; }
        if ($request_uri = /product/html/?88.html ) { return 301 https://silvfilter.com/daishi/19.html; }
        if ($request_uri = /down/class/index.php?page=1&catid=4&myord=dtime&myshownums=&showtj=&author=&key= ) { return 301 https://silvfilter.com/download/; }
        if ($request_uri = /product/class/?74.html ) { return 301 https://silvfilter.com/xinshi/; }
        if ($request_uri = /product/html/?128.html ) { return 301 https://silvfilter.com/zhushi/24.html; }
        if ($request_uri = /news/class/?86.html ) { return 301 https://silvfilter.com/company/; }
        if ($request_uri = /news/html/?383.html ) { return 301 https://silvfilter.com/tech/10.html; }
        if ($request_uri = /product/html/?126.html ) { return 301 https://silvfilter.com/zhushi/22.html; }
        if ($request_uri = /product/html/?113.html ) { return 301 https://silvfilter.com/parts/105.html; }
        location ~ \.php(.*)$ {
                fastcgi_pass  unix:/tmp/php-56-cgi.sock;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
                fastcgi_param PATH_INFO $2;
                include fcgi.conf;
        }
        location ~ /\.ht {
	            deny  all;
	    }
        location / {
                 try_files $uri $uri/ /?$args;
        }
}
server {  
  listen      80;  
  server_name    www.silvfilter.com;  
  return      301 https://silvfilter.com$request_uri;  
} 
server {  
  listen      443;  
  server_name    www.silvfilter.com;  
  return      301 https://silvfilter.com$request_uri;  
}


扫描二维码推送至手机访问。

版权声明:本文由千城笔记发布,如需转载请注明出处。

本文链接:https://oozj.org/9.html

分享给朋友:

相关文章

linux一件脚本/命令大全(持续收录)

linux一件脚本/命令大全(持续收录)

回程路由脚本,这里的回程路由是指从你的机器出发到指定节点的路由。Github地址:https://github.com/nanqinlang-script/testracewget http...

您的连接不是私密连接没有任然继续按钮

您的连接不是私密连接没有任然继续按钮

转自https://segmentfault.com/a/1190000040074507?utm_source=sf-similar-article换了个电脑,chrome访问网站又遇到了“您的连接...

如何保存 gb688 GB库文件为PDF

如何保存 gb688 GB库文件为PDF

http://c.gb688.cn/bzgk/gb/showGb?type=online&hcno= F12打开控制台,输入PDFViewerApplication.save()即可下载...

win11始终在任务栏显示所有图标

win11始终在任务栏显示所有图标

管理员运行cmd 输入 explorer shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9} 反复点击复选框然后确定保存...

win11显示以前的右键菜单

win11显示以前的右键菜单

在shell 管理员里运行reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocS...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。