htTool

htTool logo

What is this?

This is a small tool to help you with generating your .htaccess file. It's a collection of tips, tricks and techniques used in .htaccess files to provide functionality or boost performance.

How does it work?

Just enter the URL of the site you want to create the rules for and check the options you wish to use. When done, you can copy/paste your generated .htaccess information in your .htaccess file.

Hey, you missed a spot!

Wait, what? Where? If you want to contribute with some tips and tricks of your own, or want to improve some of the techniques described here, Feel Free To Fork™ this site on github and make a pull request.

URL:

Options:

Your generated .htaccess code:

(click on the code the select it all!) # REDIRECT NON-WWW to WWW # DISABLED: NO URL ENTERED # REDIRECT SITEMAP.XML TO /SITEMAPXML/ RewriteCond $1 ^sitemap.xml RewriteRule ^(.*)$ /sitemapxml/ [L] # FORCE INTERNET EXPLORER TO THE LATEST RENDER ENGINE <IfModule mod_headers.c> Header set X-UA-Compatible "IE=Edge,chrome=1" <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|xpi|safariextz|vcf)$"> Header unset X-UA-Compatible </FilesMatch> </IfModule> # COMPRESS TEXT, HTML, JAVASCRIPT, CSS, XML <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/x-component AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript </IfModule> # CACHE FILES FOR 30 DAYS <filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=2592000, public" </filesMatch> # CACHE FILES FOR 2 DAYS <filesMatch "\.(xml|txt)$"> Header set Cache-Control "max-age=172800, public, must-revalidate" </filesMatch> # CACHE FILES FOR 2 HOURS <filesMatch "\.(html|htm)$"> Header set Cache-Control "max-age=7200, must-revalidate" </filesMatch> # ADD MIME TYPES FOR VIDEO FILES AddType video/ogg .ogv AddType video/mp4 .mp4 AddType video/webm .webm # FORCE MEDIA DOWNLOADS AddType application/octet-stream .pdf AddType application/octet-stream .doc AddType application/octet-stream .docx AddType application/octet-stream .avi AddType application/octet-stream .mpg AddType application/octet-stream .mpeg AddType application/octet-stream .wmv AddType application/octet-stream .mp3 # CUSTOM ERROR DOCUMENTS ErrorDocument 401 /error/401.php ErrorDocument 403 /error/403.php ErrorDocument 404 /error/404.php ErrorDocument 500 /error/500.php # PREVENT HOTLINKING # DISABLED: NO URL ENTERED

Thank you!

Special thanks go out to: Ed Rackham, Amplify, Symphony CMS, MediaElement.js, AskApache.com, HTML5 Boilerplate, Giel Berkers, Your Name?

© 2012 Giel Berkers

Fork me on github