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

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

oozj7年前 (2017-09-12)域名主机相关3906
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

分享给朋友:

相关文章

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...

named配置DNS转发 代理8.8.8.8

named配置DNS转发 代理8.8.8.8

//// named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS //...

发表评论

访客

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