Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a Windows server running Apache.

The Apache server is successfully configured to serve 6 sites using name-based virtual hosting.

I need to add a virtual directory to ONE of these sites, and have that directory's default document be a specific file from the site's directory structure (The site uses a CMS that generates fairly unpleasant static URLs, which is why we want to do this).

So, what I want is:

http://www.oursite.com/virtual_dir

to serve content from

http://www.oursite.com/a-page-from-the-cms.html

I can't work out how/where to add the statements to create the virtual directory.

Here's a chunk from the httpd-vhosts.conf file so you can see how we have configured what is working so far (IP addresses & URLs have been changed):

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName 127.0.0.1
     DocumentRoot "E:/webs/default/"
</VirtualHost>


# Main site

<VirtualHost *:80>
    ServerAdmin webmaster@oursite.com
    DocumentRoot "E:/webs/www.oursite.com/site/"
    ServerName www.oursite.com
    ErrorLog "E:/webs/www.oursite.com/logs/oursite.com-error.log"
    CustomLog "|C:/Apache/bin/rotatelogs.exe E:/webs/www.www.oursite.com/logs/oursite.com/logs/www.oursite.com/logs/oursite.com-access.%Y-%m-%d-%H_%M_%S 86400" combined
</VirtualHost>
share|improve this question

migrated from stackoverflow.com Aug 18 '09 at 9:17

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Try the Alias directive, e.g.

Alias /virtual_dir /the/path/on/your/filesystem/to/a-page-from-the-cms.html

A more complex solution is to use mod_rewrite, but that's probably overkill.

share|improve this answer
    
This only applies to aliasing urls to the filesystem. If you want to alias urls to non-file backed content, you will need to use mod_rewrite. –  David Pashley Aug 18 '09 at 12:14
    
what about mod_vhost_alias.? –  user993553 Aug 1 '13 at 11:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.