【发布时间】:2017-10-28 09:37:09
【问题描述】:
我需要在 htaccess 中设置重定向。 我的 htaccess 在下面给出
RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . frontend/web/index.php
所以它将所有请求重定向到 frontend/web/index.php
但问题是假设以下请求来自 /site/about 目前使用上述规则 frontend/web/index.php 没有接收到路径参数。 IE。 /site/about 正在重定向到
我需要路径参数作为前端/web/index.php中的路径参数
.即。 /site/about 应该映射到 /frontend/web/index.php/site/about 路径部分也是动态的。即它可以是站点/服务之类的任何东西
如何在 htaccess 中执行该规则。我检查了其他一些解决方案,但其中大多数都说将路径参数映射到查询字符串,根据我的站点设置,我无法做到这一点。
【问题讨论】:
-
在这里看看我的问题,我觉得和你需要的很相似stackoverflow.com/questions/34181921/…