Solved

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

Posted on 2016-08-25
3
43 Views
Last Modified: 2016-08-25
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?
0
Comment
Question by:SAbboushi
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 41770019
Alias works like this

domainname/aliasname

In other words it is seen as a virtual sub-folder of the root domain.

To do what you want requires a VirtualHosts entry.
0
 

Author Closing Comment

by:SAbboushi
ID: 41770091
Thanks Julian
0
 
LVL 51

Expert Comment

by:Julian Hansen
ID: 41770358
You are welcome.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now