2017-04-27 99 views
0

我已经在本地Apache服务器上定义了这样的虚拟主机。别名在虚拟主机中的不正确工作

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "c:/wamp/www/yii/frontend/web" 
    <Directory "c:/wamp/www/yii/frontend/web"> 
    AllowOverride all 
    Require all granted 
    </Directory> 
    Alias /admin "c:/wamp/www/yii/backend/web" 
    <Directory "c:/wamp/www/yii/backend/web"> 
    AllowOverride all 
    Require all granted 
    </Directory> 
    ServerName florist 
    ErrorLog "logs/yii-error.log" 
    CustomLog "logs/yii-access.log" common 
</VirtualHost> 

URL http://florist/admin正常工作,并通过/backend/web/index.php处理。

但URL http://florist/admin/login已通过/frontend/web/index.php

处理我发现了这一点,当我在适当的放在exit()函数与相应的消息的index.php

什么问题可别名?

+0

您是否尝试将Alias放入第一行? – Bizley

回答

0

我创建simlink到c:\wamp\www\yii\backend\web

mklink/d C:\ WAMP \ WWW \警予\前端\网络\ ADMIN Ç :\ WAMP \ WWW \警予\后端\ WEB

,并在虚拟主机定义添加Options FollowSymLinks。 这是解决问题。

1

尝试在管理子文件夹添加的.htaccess:

Options +FollowSymLinks 
IndexIgnore */* 

RewriteEngine on 

# 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