Skip to content

Instantly share code, notes, and snippets.

@tynovsky
Created September 5, 2012 07:39
Show Gist options
  • Save tynovsky/3632721 to your computer and use it in GitHub Desktop.
Save tynovsky/3632721 to your computer and use it in GitHub Desktop.
apache virtualhost config file which imitates VirtualDocumentRoot with pure mod_rewrite
<VirtualHost *:80>
ServerName lo
ServerAlias *.lo
DocumentRoot /home/miroslav/www
#do the magic: something.lo => DocumentRoot/something/document_root
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]*)\.([^.]*)$
RewriteCond %{REQUEST_URI} !document_root
RewriteRule ^(.*)$ /%1/document_root$1
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
ErrorLog /var/log/apache2/lo_error.log
LogLevel debug
CustomLog /var/log/apache2/lo_access.log combined
ServerSignature On
RewriteLog "/home/miroslav/www/.log/lo_rewrite.log"
RewriteLogLevel 5
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment