[英]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.