Articles & Videos Related to Web Development

My Talks




API Design


UI & UX related



Tutorials & Inspiration

The perfect .htaccess file

# Non of this work is mine, stolen from various places
# Turn rewrite engine on
RewriteEngine On

# Disable Etags
Header unset ETag
FileETag None

# limit indexing of directories
Options All -Indexes

# Set charset encoding header to UTF-8
AddCharset UTF-8 .html

# Add expire headers
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
	Header set Expires "access plus 1 day"

# Compress plain text file
<FilesMatch "\.(js|css|html|htm|php|xml)$">
	SetOutputFilter DEFLATE

# removes php from files
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

# removes html from files
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

# Redirect requests from www to http://
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]

# GZip compression
<IfModule mod_deflate.c>
	AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css  application/x-javascript
	BrowserMatch ^Mozilla/4 gzip-only-text/html
	BrowserMatch ^Mozilla/4\.0[678] no-gzip
	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Disable the server signature
ServerSignature Off

# limit file uploads to 100K
LimitRequestBody 102400