Skip to content

Instantly share code, notes, and snippets.

@sassman
Created April 12, 2011 15:29
Show Gist options
  • Save sassman/915719 to your computer and use it in GitHub Desktop.
Save sassman/915719 to your computer and use it in GitHub Desktop.
vhost default universal template
<VirtualHost *:80>
ServerName :servername
ServerAlias :serveralias
DocumentRoot /var/www/:appname/public
# Possible values include: debug, info, notice, warn, error, crit,
LogLevel warn
ErrorLog /var/www/:appname/log/apache-error.log
CustomLog /var/www/:appname/log/apache-access.log combined
Options -Indexes FollowSymLinks
#disable htaccess starting at /
<Directory />
AllowOverride none
</Directory>
<Directory /var/www/:appname/public/>
RewriteEngine On
#RewriteBase /
# Removing www prefix
#RewriteCond %{HTTP_HOST} ^www.:serveralias$ [NC]
#RewriteRule ^(.*)$ http://:serveralias/$1 [R=301,L]
# Adding www prefix
#RewriteCond %{HTTP_HOST} ^:serveralias$
#RewriteRule (.*) http://www.:serveralias$1 [R=301]
# CakePHP Rules
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
# ZendFramework Rules
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/public.*
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
#<Files sitemap.xml>
# RewriteEngine Off
#</Files>
</Directory>
SetEnv APPLICATION_ENV ":appenv"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment