0
我红了很多帖子,但仍不知道我应该如何分开他们。我正在谈论:www.mysite.com(前端)和www.mysite.com/admin(backend)。也试过文件说它喜欢的方式Yii2管理和前端分开
<VirtualHost *:80>
ServerName frontend.dev
DocumentRoot "/path/to/yii-application/frontend/web/"
<Directory "/path/to/yii-application/frontend/web/">
# use mod_rewrite for pretty URL support
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
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName backend.dev
DocumentRoot "/path/to/yii-application/backend/web/"
<Directory "/path/to/yii-application/backend/web/">
# use mod_rewrite for pretty URL support
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
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
但是从所有我红我认为这是不正确的方式。请你帮忙,我已经在几个小时之内挣扎了,而且没有结果。先谢谢你!
请参阅https://github.com/mickgeek/yii2-advanced-one-domain-config – Bizley
当我尝试输入.... /管理我得到404错误没有找到:/ –