【问题标题】:Convert htaccess for nginx为 nginx 转换 htaccess
【发布时间】:2016-11-18 17:53:34
【问题描述】:

对 htaccess 大师的快速提问。

如何为 nginx 转换这个 .htaccess 文件?

<IfModule   mod_rewrite.c>
RewriteEngine   On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$  index.php?url=$1 [PT,L]

</IfModule>

【问题讨论】:

    标签: apache .htaccess nginx


    【解决方案1】:

    在您的 location / 指令中尝试此规则与您的其他规则。

    location / {
        rewrite ^(.*)$ index.php?url=$1 last;
    }
    

    然后重新加载或重新启动服务器。

    【讨论】:

    • 不,这似乎不起作用,即使是根路由也因重写而失败
    • 你能告诉我你在哪里应用规则的完整指令吗?
    猜你喜欢
    • 2018-07-10
    • 2017-08-02
    • 2011-05-07
    • 1970-01-01
    • 1970-01-01
    • 2013-02-02
    • 2015-05-21
    相关资源
    最近更新 更多