Skip to content

Instantly share code, notes, and snippets.

@wdalmut
Created June 21, 2012 18:28
Show Gist options
  • Save wdalmut/2967603 to your computer and use it in GitHub Desktop.
Save wdalmut/2967603 to your computer and use it in GitHub Desktop.
.htaccess useful rules
# Rewrite non www urls to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
<VirtualHost *:80>
ServerName example.com
DocumentRoot /path/to/eg
# Write logs to /path/to/eg/rewrite.log
RewriteLog rewrite.log
# Semi-verbose log
RewriteLogLevel 5
# Turn on rewrite and inherit rules
RewriteEngine On
RewriteOptions Inherit
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment