我想重定向到我的控制器 - SiteController.php
和操作actionLanguage
。我认为我的htaccess
可以,但无法达成行动。我想在网址中添加的所有内容都会导致我admin/site/index
而不是admin/site/language
。我的.htaccess
:
# prevent directory listings
Options -Indexes
# follow symbolic links
Options FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/admin/gii/?$
RewriteRule . backend/web/index.php?r=gii [L]
RewriteCond %{REQUEST_URI} ^/admin
RewriteRule ^admin(/.+)?$ /backend/web/$1 [L,PT]
RewriteCond %{REQUEST_URI} ^.*$
RewriteRule ^(.*)$ /frontend/web/$1
当我输入RewriteRule ^admin(/.+)?$ /backend/web/$1 [L,PT]
时,此行backend/web/site/language
必须执行到www.website.com/admin/site/language
吗?或者我有些错误?它现在将请求重定向到admin/site/index
。感谢每一个建议!提前谢谢!
修改:
后端.htaccess
:
AddDefaultCharset utf-8
Options FollowSymLinks
IndexIgnore */*
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 . index.php
RewriteRule ^static - [L]