Skip to content

Instantly share code, notes, and snippets.

@daljeet-singh
Created May 31, 2016 08:38
Show Gist options
  • Save daljeet-singh/16be5e6f778d84a1c83d69b7693f2167 to your computer and use it in GitHub Desktop.
Save daljeet-singh/16be5e6f778d84a1c83d69b7693f2167 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