Skip to content

Instantly share code, notes, and snippets.

@akamola
Created May 31, 2013 08:34
Show Gist options
  • Save akamola/5683621 to your computer and use it in GitHub Desktop.
Save akamola/5683621 to your computer and use it in GitHub Desktop.
HTACCESS: Basic configuration for web projects for Apache web servers
# PHP
php_flag register_globals off
php_flag short_open_tag off
# Set default charset to UTF-8
AddDefaultCharset UTF-8
# File types
AddType text/vcard .vcf .vcard
AddType text/xml .rss
# Directory settings
## Set directory index
DirectoryIndex index.php index.html index.htm
## Hide index
Options -Indexes
# Rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
## Remove WWW prefix
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*) http://example.com/$1 [L,R]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment