我正在开发Yii 1.1中的应用程序
我想将frontend
和backend
分开。 Doc在这里:Yii 1.1: Organize directories for applications with front-end and back-end using WebApplicationEnd behavior
我的根目录index.php
和admin.php
我希望index.php
通过frontend.dev
和admin.php
backend.dev
文件访问<VirtualHost *:80>
ServerName frontend.dev
DocumentRoot "C:\xampp\htdocs\myproject"
<Directory "C:\xampp\htdocs\myproject">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName backend.dev
DocumentRoot "C:\xampp\htdocs\myproject"
<Directory "C:\xampp\htdocs\myproject">
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . admin.php
DirectoryIndex admin.php
Require all granted
</Directory>
</VirtualHost>
文件。{/ 1}
代码:
http://backend.dev
如果我打开admin.php
,那么这个工作正常。我的默认http://backend.dev/post/test
页面工作在虚拟DirectoryIndex中设置。但是当我访问任何其他控制器和index.php
之类的操作时,此URL正在访问AddDefaultCharset utf-8
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# Make the backend accessible via url: http://site/backend.
RewriteRule ^admin admin.php
# 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
文件。如何管理?
请帮忙
编辑:
x <- c(L1, L2)
lapply(split(x, names(x)), function(i){
xsub <- do.call(c, unname(i))
lapply(split(xsub, names(xsub)), function(j) do.call(rbind, unname(j)))
})
答案 0 :(得分:0)
以下内容可以进入你的vhost文件
<VirtualHost *:80>
ServerName frontend.dev
DocumentRoot "C:\xampp\htdocs\myproject"
<Directory "C:\xampp\htdocs\myproject">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName backend.dev
DocumentRoot "C:\xampp\htdocs\myproject"
<Directory "C:\xampp\htdocs\myproject">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
以下内容可以进入.htaccess文件。
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^frontend.dev
RewriteRule ^(.*) index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^backend.dev
RewriteRule ^(.*) admin.php [L]
注意到
RewriteCond %{HTTP_HOST} ^frontend.dev
和
RewriteCond %{HTTP_HOST} ^backend.dev
这将正确地将域的请求转发到其各自的文件。