Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using apache server and PHP, I've just done a cms, and now I would like to provide some demos at different URLs, BUT within the same domain, for example

Something like this: ...

If those were the corresponding real paths on my server:


I don't want to change my cms code to achieve this (if possible)

The first solution I thought of was buy a domain for each demo, and use Virtual Hosting to map a demo to a domain. That would do exactly what I want, but that would be too expensive...

With Alias directive,

Alias /demo1/ /myserver/cms/demo1

is almost perfect, but I still got the problem that the $_SERVER['REQUEST_URI'] variable is modified from / to /demo1, which unfortunately makes my cms confuse.

I would need a truly unobstrusive way of doing this, like with virtual hosts.

If you've faced that problem too, I would like to hear how you dealed with it.

share|improve this question

I use sub-domains (,, etc.) with a wildcard DNS entry (* always resolves to the same host) so that I don't have to make any DNS changes, I only have to add more virtual hosts to Apache.

Works well.

share|improve this answer
Thank you. I'll try that! – ling Apr 20 '12 at 18:27

Answer to myself::

If you were interested by the topic, here is how I did ( and it worked, thanks to gravyface, ):

<VirtualHost *:80>
    ServerName test.jetdemo
    ServerAlias test.jetdemo
    DocumentRoot "/Volumes/Mac/projets/jetsites/demo/ecommerce/store1/application/www"
<VirtualHost *:80>
    ServerName jetdemo
    ServerAlias *.jetdemo
    DocumentRoot "/Volumes/Mac/projets/jetsites/demo/" 

I've noticed that the order of the virtual hosts' bloc is important: the bloc containing the wildcard ( ServerAlias *.jetdemo ) has to be the last one, otherwise it won't work!, or you'll have to remove the wildcard ( ServerAlias jetdemo ).

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.