jayrui612 2017-08-24 18:02:28 4463次浏览 1条评论 0 1 0

admin.XXX.com 指向网站的后台目录 /backend/web

www.XXX.com 指向网站的前台目录 /frontend/web
网上找教程看了好多 大致我是操作不会的 自己还是以之前本地虚拟指向的方式来实现

首先你要在自己的域名空间下 配置好二级目录
假设你已经配置好了
在lamp环境下 /etc/httpd/conf 目录下的
httpd.conf文件
再最后面添加

NameVirtualHost *:80
<VirtualHost *:80>
    #ServerAdmin tech@sanlischool.com
    DocumentRoot /var/www/html/ceshi/frontend/web
    ServerName www.duanhaochen.com
    ErrorLog logs/mall.sanlischool.com-error_log
    CustomLog logs/mall.sanlischool.com-access_log common
    <Directory />
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order deny,allow
                Allow from all
                RewriteEngine On
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteRule ^(.*)$ /index.php/$1 [L]
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    #ServerAdmin tech@sanlischool.com
    DocumentRoot /var/www/html/ceshi/backend/web
    ServerName admin.duanhaochen.com
    ErrorLog logs/mall.sanlischool.com-error_log
    CustomLog logs/mall.sanlischool.com-access_log common
    <Directory />
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order deny,allow
                Allow from all
                RewriteEngine On
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteRule ^(.*)$ /index.php/$1 [L]
    </Directory>
</VirtualHost>

然后重启 apache就可以了

觉得很赞
您需要登录后才可以评论。登录 | 立即注册