Skip to content

Instantly share code, notes, and snippets.

@sassman
Created September 21, 2010 10:49
Show Gist options
  • Save sassman/589530 to your computer and use it in GitHub Desktop.
Save sassman/589530 to your computer and use it in GitHub Desktop.
vhosts examples and snippets
<?php
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => ':user',
'password' => ':password',
'database' => ':database',
'prefix' => '',
'encoding' => 'utf8'
);
}
<VirtualHost *:80>
ServerName :servername
ServerAlias :serveralias www.:serveralias
# ServerAlias :serveralias
DocumentRoot /home/sassman/web/:appname/app/webroot
Options -Indexes FollowSymLinks
#disable htaccess starting at /
<Directory />
AllowOverride none
</Directory>
<Directory /home/sassman/web/:appname/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>
<VirtualHost *:80>
ServerName :servername
ServerAlias :serveralias www.:serveralias
DocumentRoot /var/vhosts/:appname/app/webroot
# Possible values include: debug, info, notice, warn, error, crit,
LogLevel warn
ErrorLog /var/vhosts/:serveralias/logs/apache2_error.log
CustomLog /var/vhosts/:serveralias/logs/apache2_access.log combined
Options -Indexes FollowSymLinks
#disable htaccess starting at /
<Directory />
AllowOverride none
</Directory>
<Directory /var/vhosts/:appname/app/webroot/>
RewriteEngine On
RewriteBase /
# removing www
#RewriteCond %{HTTP_HOST} ^www.:serveralias$ [NC]
#RewriteRule ^(.*)$ http://:serveralias/$1 [R=301,L]
# adding www
#RewriteCond %{HTTP_HOST} ^:serveralias$
#RewriteRule (.*) http://www.:serveralias$1 [R=301]
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