转换mod_rewrite的Apache以Nginx的? [英] Convert mod_rewrite Apache to Nginx?
本文介绍了转换mod_rewrite的Apache以Nginx的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在网络编程新手。我想阿帕奇切换到Nginx的网络服务器,但仍对Nginx的方式重写问题。
I'm newbie on internet programming. I want to switch Apache to Nginx web server but still problem on Nginx mode rewrite.
我的网站位置/的public_html /读/ 和我的previous 的.htaccess
My website location on /home/user/public_html/read/
and my previous .htaccess
file on /home/user/public_html/read/.htaccess
like this:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^mangas/([^/]+)/([^/]+)/$ - [F,L]
RewriteRule ^mangas/([^/]+)/$ - [F,L]
RewriteRule ^mangas(/?)$ - [F,L]
RewriteRule ^([^/.]+)/([^/.]+)/([0-9]+)(/?)$ index.php?manga=$1&chapter=$2&page=$3 [L]
RewriteRule ^([^/.]+)/([^/.]+)(/?)$ index.php?manga=$1&chapter=$2 [L]
RewriteRule ^([^/.]+)(/?)$ index.php?manga=$1 [L]
我如何转换这mod_rewrite的nginx的? (我soory,因为我的英语拼写是不完美的)
How can I convert this mod_rewrite to nginx? (I'm soory because my english spell is not perfect)
推荐答案
尝试这些在服务器{}
:
location ~ ^/mangas/([^/]+)/([^/]+)/$ {
return 403;
}
location ~ ^/mangas/([^/]+)/$ {
return 403;
}
location ~ ^/mangas(/?)$ {
return 403;
}
location / {
rewrite ^/([^/.]+)/([^/.]+)/([0-9]+)(/?)$ /index.php?manga=$1&chapter=$2&page=$3 break;
rewrite ^/([^/.]+)/([^/.]+)(/?)$ /index.php?manga=$1&chapter=$2 break;
rewrite ^/([^/.]+)(/?)$ /index.php?manga=$1 break;
}
这篇关于转换mod_rewrite的Apache以Nginx的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文