Skip to content

Instantly share code, notes, and snippets.

@holly
Created November 19, 2012 16:31
Show Gist options
  • Save holly/4111651 to your computer and use it in GitHub Desktop.
Save holly/4111651 to your computer and use it in GitHub Desktop.
apache cakephp vhost config
<VirtualHost *:80>
#this handles sitename.example.com
ServerName example.com
ServerAlias *.example.com
Options -Indexes FollowSymLinks
UseCanonicalName Off
VirtualDocumentRoot /opt/example/sites/%1/app/webroot
<Directory />
AllowOverride none
</Directory>
<Directory "/opt/example/sites/*/app/webroot/">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/opt/example/sites/(.*)/app/webroot/(.*)$ index.php?url=$2 [QSA,L]
<Files sitemap.xml>
RewriteEngine Off
</Files>
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.example.com
ServerAlias www.example.com example.com
DocumentRoot /var/www/example/app/webroot
Options -Indexes FollowSymLinks
#disable htaccess starting at /
<Directory />
AllowOverride none
</Directory>
<Directory /var/www/example/app/webroot/>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
<Files sitemap.xml>
RewriteEngine Off
</Files>
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment