昊天SEO

nginx 重定向规则

nginx

nginx

 

下面就是nginx的conf的内容

server
{
listen 80;
#listen [::]:80;
server_name www.abc.com abc.com; #需要绑定的域名
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/abc.com;#网站路径
# 301 跳转规则开始
if ($host = 'abc.com' ) { 
rewrite ^/(.*)$ http://www.abc.com/$1 permanent; 
}
# 301 跳转规则结束
include wordpress.conf;
#引入wordpress伪静态规则
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log /home/wwwlogs/abc.com.log access;
}

本文地址官网    新乡网站建设,seo

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址