Skip to content

Instantly share code, notes, and snippets.

@mchamplain
Created March 26, 2012 11:26
Show Gist options
  • Save mchamplain/2204509 to your computer and use it in GitHub Desktop.
Save mchamplain/2204509 to your computer and use it in GitHub Desktop.
Dynamic apache configuration for dev
<VirtualHost *:80>
ServerName dev.local
ServerAlias *.dev.local
DocumentRoot /var/www/vhosts/
# get the server name from the Host: header
UseCanonicalName Off
LogLevel warn
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/log/apache2/dynamic.log vcommon
ErrorLog /var/log/apache2/dynamic.error.log
RewriteLogLevel 0
RewriteLog /var/log/apache2/dynamic.rewrite.log
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /var/www/vhosts/%-3-/public
DirectoryIndex index.php
<Directory /var/www/vhosts/*/public>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# For VirtualDocumentRoot configurations
RewriteRule ^(.*)$ /index.php [L,QSA]
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment