我已经安装了Yii2高级应用程序,我现在要做的就是将这个url htpp://site/admin重定向到后端(管理)端。到目前为止,我尝试的是:
AddDefaultCharset utf-8
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# Make the backend accessible via url: http://site/admin
RewriteRule ^admin$ $admin.php [L]
# 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]我不熟悉.htaccess,我也不太确定什么是正确的方式。这段代码是我在谷歌搜索后发现的。app/backend/web/.htaccess中包含.htaccess文件。你能给我指出正确的路吗?提前谢谢你!
发布于 2017-12-27 03:12:01
简单:
RewriteEngine On
# End the processing, if a rewrite already occurred
RewriteRule ^(frontend|backend)/web/ - [L]
# Handle the case of backend, skip ([S=1]) the following rule, if current matched
RewriteRule ^admin(/(.*))?$ backend/web/$2 [S=1]
# handle the case of frontend
RewriteRule .* frontend/web/$0
# Uncomment the following, if you want speaking URL
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^([^/]+/web)/.*$ $1/index.phphttps://stackoverflow.com/questions/47912419
复制相似问题