Blogging SEO Tutorials

Important htacess commands for blog and websites


Its doesn’t matter which kind of web hosting your are using Shared or VPS but in both servers .htaccess has its own important contribution which can impact your search engine option and many other things such as speeding up your blog, enable cache, redirection of domain name and much more.

  1. Enabling GZIP using .htaccess:

    By enabling ZGIP for you blog or website you may increase its loading time upto 30-50% faster. It is best to compress the HTML to reduce your web site size in addition to page running times – this will help your website retain visitors and improve page opinions.


Setting ZGIP using htaccess on Apache server: Most of us using apache server for their web hosting service which means you can directly follow our instructions and turn on GZIP by adding a few deflate codes to your .htaccess file.

# compress text, html, javascript, css, xml:

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript


  1. URL Canonicalization Redirection:

    In this case you can redirect your no-www url to www url, basically its creates confussion bitween search engine and your exact url, its becomes hard to ditermind which one your correct url need to be indexed by google or other search engines. By adding few lines in your htaccess file your can easily resolve this issue.

If you want to redirect www to non-www url:

RewriteCond %{HTTP_HOST} ^www\.example\.com$

RewriteRule ^/?$ “http\:\/\/example\.com\/” [R=301,L]

If you want to redirect non www to www url:

RewriteCond %{HTTP_HOST} !^$ [NC]

RewriteRule ^(.*)$$1 [L,R=301]

3. Libwww-perl Access:

Check in case your server makes it possible for access from User-agent Libwww-perl. Botnet scripts which automatically seek out vulnerabilities in your software are sometimes identified since User-Agent libwww-perl. By preventing access from libwww-perl it is possible to eliminate quite a few simpler problems.

RewriteCond %{HTTP_USER_AGENT} libwww-perl.*

RewriteRule .* – [F,L]


About the author

Rajesh Chauhan

GoogieHost is one of the leading free web hosting provider on the internet over 300000 satisfied clients across the globe. We also offer Affordable SEO Web Hosting and Digital Marketing service to give give wings to your online business. Unlimited FREE HOSTING.

Hey! leave comment to ask your queries about this topic.

Powered by GoogieHost