转换的.htaccess nginx的(mod_rewrite的) [英] Converting .htaccess to nginx (mod_rewrite)
问题描述
我有以下的.htaccess文件我的Apache:
I've got the following .htaccess file for my apache:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
RewriteRule ^$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?page=$1 [QSA,L]
</IfModule>
突然,我不得不改变我的网络服务器,以nginx的,我不知道为什么,但mod-rewrite是行不通的。
Suddenly I had to change my webserver to nginx and I don't know why, but the mod rewrite is not working.
我用了一个网上转换器转换,所以我有以下几点:
I used an online 'converter' to convert it, so I've got the following:
location / {
rewrite ^/$ / index.php break;
if ($request_filename ~ !-f){
rewrite ^(.*)$ / index.php?page=$1 break;
}
}
你能不能帮我出了什么问题?
Could you help me what's wrong?
在此先感谢, 马塞尔·
Thanks in advance, Marcell
推荐答案
<一个href="http://blog.martinfjordvald.com/2011/02/nginx-primer-2-from-apache-to-nginx/">http://blog.martinfjordvald.com/2011/02/nginx-primer-2-from-apache-to-nginx/ 一切都在里面。没有更多的.htaccess,没有更多的复杂的规则使用try_files。
http://blog.martinfjordvald.com/2011/02/nginx-primer-2-from-apache-to-nginx/ Everything is inside. No more .htaccess, no more complex rules use try_files.
修改:如果不是很明显,不信任的在线转换器
EDIT: And if it is not obvious, do not trust online converters.
这篇关于转换的.htaccess nginx的(mod_rewrite的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!