evgeny_s
evgeny_s

Reputation: 401

Alias incorrect working in a virtual host

I have defined such virtual host on a local Apache server.

<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 works correctly and processed by /backend/web/index.php.

But URL http://florist/admin/login have processed by /frontend/web/index.php

I found this out when I placed exit() function with appropriate message in appropriate index.php

What's wrong may be in the alias?

Upvotes: 0

Views: 300

Answers (2)

evgeny_s
evgeny_s

Reputation: 401

I have created simlink to c:\wamp\www\yii\backend\web

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

and add Options FollowSymLinks in the virtual host definition. It's resolve a problem.

Upvotes: 0

zakrzu
zakrzu

Reputation: 595

Try add .htaccess in admin subfolder:

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

Upvotes: 1

Related Questions