【问题标题】:Convert htaccess rules routing paths to index.php to nginx将htaccess规则路由路径转换为index.php到nginx
【发布时间】:2015-02-06 11:58:59
【问题描述】:

我是 nginx 新手,但我正在尝试转换

# Disallows file browsing
Options -Indexes
# Custom Error Pages
ErrorDocument 403 /error-docs/403.php
ErrorDocument 404 /error-docs/404.php
ErrorDocument 500 /error-docs/500.php
# Turn on the Apache Rewrite Engine
RewriteEngine On
#Conditional to see if it is a real file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# If not then pass the query string to index.php and stop any further rules
RewriteRule (.*) index.php/$1 [PT,L]

到 nginx 语法。我已经在Routing requests through index.php with nginx 尝试过这个建议,但它并不能完全满足我的需要。我也尝试过自动转换器http://winginx.com/en/htaccesshttp://www.anilcetin.com/,但它们输出的规则对我也不起作用。任何帮助表示赞赏。

【问题讨论】:

标签: apache .htaccess nginx


【解决方案1】:

我遇到的问题实际上与我的 PHP 和 MySQL 代码有关。

location / {
    try_files $uri $uri/ /index.php$args;
}

工作正常。感谢您的链接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-17
    • 2017-07-15
    • 2015-09-09
    • 1970-01-01
    • 2013-01-04
    • 2014-11-07
    相关资源
    最近更新 更多