Link to home
Start Free TrialLog in
Avatar of SAbboushi
SAbboushiFlag for United States of America

asked on

Alias for "domain to path" translation instead of VirtualHost on Apache

Doing some development work for a website.  Trying to setup a test environment using Apache on local Windows 10 pc.

I've added an entry to Hosts file to redirect www.w2w3w2.com to localhost.  However, I also want to redirect to a filesystem folder path (i.e. other than DocumentRoot).

I tried using the following Aliases, but url was not redirected away from DocumentRoot (and no errors in error.log):
Alias /www.w2w3w2.com /w2w3w2
Alias /w2w3w2 /"D:/Documents/www/w2w3w2"
Alias /w2w3w2 /D:/Documents/www/w2w3w2
Alias /www.w2w3w2 /D:/Documents/www/w2w3w2
Alias /www.w2w3w2.com /D:/Documents/www/w2w3w2

I am using Options Indexes on DocumentRoot and can navigate to /w2w3w2 and see/execute contents, so doesn't look like an access control issues.

If I add the following VirtualHost block, then it works fine:
<VirtualHost *:80>
    DocumentRoot "D:/Documents/www/w2w3w2"
    ServerName www.w2w3w2.com
</VirtualHost>

Why can't I get the Alias directive to work?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAbboushi

ASKER

Thanks Julian
You are welcome.