.htaccess Useful tips

To disable directory Browsing :


# To Disable Directory Browsing
Options All -Indexes

Domain Redirection:

.htacces code for redirecting yourdomain.com to www.yourdomain.com


RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]

To Hide the Extension:


RewriteRule ^([^/.]+)/?$ $1.html

 

How to do redirection properly using .htaccess

Hey, i think redirection is more important for SEO. Here i would like to share some information related to .htaccess and this may help you.

Using .htaccess file, you can easily configure and redirect Apache Web Server file system.

We may need to set the URL Redirection from OLD one to new One. then we can use the following code in .htaccess file(which is 301 redirect).

Redirect 301 /old.html http://site.com/new.html/

by adding that code in .htaccess, you can do redirection from old url to new url as per your need.