我设法用.htaccess文件隐藏了frontend/web和backend/web/。但urlManager无法理解这一点。我正在尝试创建像site/index这样的url,它应该是这样的:example.com/site/index,但它创建了example.com/frontend/web/site/index。
如何使用UrlManager解决此问题
更新:根目录中的.htaccess。
Options -Indexes
RewriteEngine on
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css)/
RewriteCond %{REQUEST_URI} admin
RewriteRule .* backend/web/index.php [L]
RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css)/
RewriteCond %{REQUEST_URI} !admin
RewriteRule .* frontend/web/index.php [L]
</IfModule>下面是我在frontend/web和backend/web中使用的方法
RewriteEngine on
# if a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward the request to index.php
RewriteRule . index.php发布于 2015-07-05 20:48:08
我使用this .htaccess配置,它对我来说工作得很好。您的站点根目录中只需要一个.htaccess文件,并按照说明设置前端/后端配置。也许这对你也是有效的。
https://stackoverflow.com/questions/31228730
复制相似问题