千城笔记
扫描关注千城笔记

这是我头像帅不帅?

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

千城笔记2017-09-12域名主机相关 602
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;  
}


发表评论