Thursday, June 2, 2016

Using an htaccess file

What I learned this week...

I had a basic understanding of what this was used for before, but it wasn't until Google came out with its new "Hostname Redundancy Warning" on Google Analytics, and I looked into it a little more that I really found out how many cool things we can do with the .htaccess file.

Definition

The definition below is shared from here at godaddy.com. Because, why try to improve upon something that is already so well defined. 

What is .htaccess?

Using .htaccess files lets you control the behavior of your site or a specific directory on your site. For example, if you place an .htaccess file in your root directory, it will affect your entire site (www.coolexample.com). If you place it in a /content directory, it will only affect that directory (www.coolexample.com/content).
.htaccess works on our Linux servers.


Using an .htaccess file, you can:
  • Customize the Error pages for your site.
  • Protect your site with a password.
  • Enable server-side includes.
  • Deny access to your site based on IP.
  • Change your default directory page (index.html).
  • Redirect visitors to another page.
  • Prevent directory listing.
  • Add MIME types.

For specifics on how to  resolve the new "Hostname Redundancy Warning" mentioned above - check out this great post : How To Solve the "Redundant Hostname" Warning in Google Analytics

.htaccess Generator

My favorite thing about all of this, is the very simple (new-to-me) .htaccess Generator found at http://www.htaccessredirect.net/  To be fair, most or all of this can be done within the cPanel but I like how this breaks down. 

rewrite to www
This is where  you would go to redirect your www.yourdomain.com to yourdomain.com. This solves the double hostname issue, I mentioned before, several times.


•••••••••••••••••••••••••••••••••


 
Custom Error Pages, in my opinion, make your site look a million times more professional. Now when your site/page won't display - for whatever reason - you can explain to your visitors exactly what is happening and reassure them that they are on the correct website.




•••••••••••••••••••••••••••••••••



We include blocking bots in all of our Google Analytics accounts, but this is a great way to stop them at the source.

•••••••••••••••••••••••••••••••••



Easily change your default directory page. If you want your products or pricing page to be the first page your visitors are directed to - this is where you would specify that.

There are several other options from blocking IP addresses, to creating password protection to the site or files. For more information visit htaccessredirect.net and click on the blue links for more information. Of course, once you generate the file you need to save it into your root folder.


I'm excited to use this new tool! What is one way that you can use this tool to make your website better?

No comments:

Post a Comment