转换的.htaccess nginx的(mod

编程入门 行业动态 更新时间:2024-10-07 16:22:47
本文介绍了转换的.htaccess 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

推荐答案

blog.martinfjordvald/2011/02/nginx-primer-2-from-apache-to-nginx/ 一切都在里面。没有更多的.htaccess,没有更多的复杂的规则使用try_files。

blog.martinfjordvald/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

本文发布于:2023-11-02 06:18:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551600.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:htaccess   nginx   mod

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!