首先,我为英文中的任何错误道歉
好吧,我的问题是:
我有一个文件夹,它有后端,并在以下路径中接收请求
[root]/backend/www(which contains an index.php file that handles requests)
我有一个前端的文件夹,并在以下路径中接收请求
[root]/frontend/www(which contains an index.php file that handles requests)
我还有一个名为common的文件夹,它在后端和前端之间共享(包含框架的库以及其他文件)
需要什么,是什么时候访问这个位置:
h**p://localhost/andre/admin
重写为:
h**p://localhost/andre/backend/www
(目前情况)
换句话说,而不是通过以下方式访问后端:
h**p://localhost/andre/backend/www
使用这个地址:
h**p://localhost/andre/admin
所有其他不指向的请求
h**p://localhost/andre/admin
访问方式:
h**p://localhost/andre/ (ie, point to h**p://localhost/andre/frontend/www)
(我希望你能理解我想要什么)
我需要帮助,在使用.htaccess文件的方法上,我不能使用Symlinks或子域来解决这个问题。。。
我在谷歌和这里搜索了很多,但没有找到任何有效的或可以帮助我的人
PS:我正在使用Yii Framework和YiiBoilerplate,但我认为解决方案不应该出现在中
提前感谢!
已解决,代码为:
RewriteEngine On
RewriteBase /andre/
RewriteRule ^admin(/.*)?$ backend/www/index.php/$1 [L,NC]
RewriteCond %{REQUEST_URI} !/(frontend|backend)/ [NC]
RewriteRule ^(.*)?$ frontend/www/index.php/$1 [L,NC]
将此代码放入/andre/.htaccess
文件:
RewriteEngine On
RewriteBase /andre/
RewriteRule ^admin(/.*)?$ backend/www$1 [NC,L]
RewriteCond %{REQUEST_URI} !/(frontend|backend)/ [NC]
RewriteRule ^(.*)$ frontend/www/index.php/$1 [L]