【发布时间】:2012-03-05 15:07:00
【问题描述】:
我正在尝试使用通常在 nginx 上的 Apache 上运行的内部框架。我一直没有运气转换 htaccess。
我试过http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ 无济于事。然后我自己做了(想出了不同的规则),这也不起作用。这是我目前拥有的:
index index.php;
location / {
if ( !-e $request_filename ) {
rewrite ^(.*)$ /index.php?$1 last;
break;
}
rewrite ^/$ /? last;
}
location ~ ^/(assets|robots\.txt|favicon\.ico|license.txt) {
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
我要转换的 htaccess 是:
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico|license.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
RewriteCond %{QUERY_STRING} .
RewriteRule ^$ /? [L]
会有人碰巧知道出了什么问题或我应该怎么做吗?
谢谢!
【问题讨论】: