Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 working on an application for my clients that allows them to set up small landing pages for their campaigns. I have a set of templates and views for adding text, photos etc to the templates. Everything works pretty well straight out of the box, with authentication, admin views etc. I'm using the Laravel framework.

Each client and campaign has an url friendly title to use in custom front end URL, i.e. "". These URL titles are unique. In addition to this, I want to allow my clients to point custom subdomains (or any domain for that matter) to their campaign. For example would pointing the domain "" fetch the correct front end for that campaign. I've solved this very easily in Laravel, just by adding an input field for custom URL, and looking that up in the front end.

However, I have problems with setting up virtual hosts in Apache correctly. I have an VPS with multiple sites, all which have the following configuration:

<VirtualHost *:80>
  DocumentRoot /data1/www/kampanjeweb/public

  LogLevel warn
  ErrorLog /logs/www/kampanjeweb_error.log
  CustomLog /logs/www/kampanjeweb_access.log common

  <Directory />
    AllowOverride All
    Options FollowSymLinks MultiViews
    Order allow,deny
    Allow from all

With this vhost snippet I need to define each ServerAlias server, but I would love to be able to let the clients update their custom URL settings without having me to do any customizing.

Have any of you done this before? What I basically want, is that any domain or request that doesn't match any of the virtual hosts files in Apache, should go to this virtual host.

share|improve this question

Rename this virtual-host to 000-<old name> Making sure it sorts first lexicographically. When requests come to the server that doesn't match any of your vhosts, it will default to the first one.

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.