【问题标题】:Cnvert nginx try file_files to apache rule将 nginx 尝试文件文件转换为 apache 规则
【发布时间】:2021-12-04 10:46:19
【问题描述】:

嗨, 我想把它转换成 apache

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

我该怎么办? 谢谢你

【问题讨论】:

  • 你需要什么 PHP 框架?
  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。

标签: apache nginx


【解决方案1】:

这可能有效。我从 Laravel 复制它,这是一个非常常见的 PHP 框架

<IfModule mod_rewrite.c>
    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

【讨论】:

  • 我去试试谢谢
猜你喜欢
  • 2012-08-25
  • 1970-01-01
  • 1970-01-01
  • 2017-09-23
  • 2019-03-10
  • 1970-01-01
  • 2019-09-13
  • 2016-06-18
  • 2021-07-08
相关资源
最近更新 更多