首页 > 请帮我转一下.access到nginx配置,谢谢

请帮我转一下.access到nginx配置,谢谢

一、原有apache下的.access规则如下
<IfModule mod_rewrite.c>

  RewriteEngine on
程序设定的url优化

RewriteRule ^(.*)(/|(/index))$ http://www.51gso.com/$1 [NC,L,R=301]
RewriteRule ^index.php$ http://www.51gso.com [NC,L,R=301]

单一入口

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

二、利用在线工具http://winginx.com/en/htaccess得到的设置

nginx configuration

location / {
rewrite ^/(.*)(/|(/index))$ http://www.51gso.com/$1 redirect;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php/$1 break;
}
}
location /index {
rewrite ^/index.php$ http://www.51gso.com redirect;
}

三、原来的默认配置

  include other.conf;
    #eror_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;
    }

四、我的做法,
把3和4加在一起,还是不起作用

五、做法二
之用三,去掉四/
导致重定向过多,

求解决办法,谢谢

【热门文章】
【热门文章】