繁体   English   中英

别名在虚拟主机中工作不正确

[英]Alias incorrect working in a virtual host

我已经在本地Apache服务器上定义了这样的虚拟主机。

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    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处理

我在适当的index.php中放置带有适当消息的exit()函数时发现了这一点

别名有什么问题?

尝试在admin子文件夹中添加.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

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

mklink / D c:\\ wamp \\ www \\ yii \\ frontend \\ web \\ admin c:\\ wamp \\ www \\ yii \\ backend \\ web

并在虚拟主机定义中添加Options FollowSymLinks 解决了一个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM