Last active
August 29, 2015 14:08
-
-
Save gowthamsadasivam/f786f9cffab3affd3f40 to your computer and use it in GitHub Desktop.
Default Apache HTTP Server Configuration File - .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
# Redirect non-www URLs to www URL - Canonical URL redirection | |
# Replace YOURDOMAIN.TLS with your actual domain name | |
RewriteCond %{HTTP_HOST} !^www.YOURDOMAIN.TLS$ [NC] | |
RewriteRule ^(.*)$ http://www.YOURDOMAIN.TLS/$1 [L,R=301] | |
# Replace 0.0.0.0 with YOUR (SHARED/DEDICATED)IP ADDRESS | |
RewriteCond %{HTTP_HOST} ^0.0.0.0$ [NC] | |
RewriteRule (.*)$ http://www.YOURDOMAIN.TLS/$1 [R=301,L] | |
ErrorDocument 404 /404.html | |
# Remove ETag from the files | |
FileETag none | |
# Avoid character set in metatag | |
AddDefaultCharset UTF-8 | |
# Add correct content-type for fonts and HTML5 elements | |
AddType application/vnd.ms-fontobject .eot | |
AddType font/ttf .ttf | |
AddType font/otf .otf | |
AddType font/x-woff .woff | |
AddType image/svg+xml .svg | |
AddType video/ogg .ogv | |
AddType video/webm .webm | |
AddType video/mp4 .mp4 | |
AddType audio/aac .aac | |
AddType audio/mp4 .m4a | |
AddType audio/mpeg .mp1 .mp2 .mp3 .mpg .mpeg | |
AddType audio/ogg .oga .ogg | |
AddType audio/wav .wav | |
# Compress Starts | |
# BEGIN GZIP | |
<ifmodule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript font/x-woff font/ttf font/otf image/svg+xml image/jpeg image/jpg image/png video/webm video/mp4 video/ogv | |
</ifmodule> | |
# END GZIP | |
# Compress End | |
#HTTP Cache Headers Starts | |
<IfModule mod_headers.c> | |
# Cache static files | |
<FilesMatch "\.(css|js|jpg|jpeg|png|gif|swf|woff|ttf|otf|svg|webm|mp4|ogv)$"> | |
# Cache maximum age set to one week | |
Header set Cache-Control "max-age=604800, public" | |
</FilesMatch> | |
#HTTP Cache Headers Ends |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment