The .htaccess file is the main configuration file for URL Rewriting software, such as Apache’s mod_rewrite and Helicon’s ISAPI_Rewrite. An .htaccess file can be used to perform many different SEO-related tasks. Whether or not your web host allows the use of the .htaccess file can mean all the difference in the world when planning an SEO strategy for your website. In all of our client projects, we use the .htaccess file to perform some SEO-critical functions. One of the most important functions that the .htaccess file can perform is domain name canonicalization.
Domain Name Canonicalization
If a domain name is not canonicalized, it means that the same site will be presented to the browser when different combinations of a domain are requested. For example, consider the following urls:
http://www.domain.com
http://domain.com
While both of the examples above look the same, they are in fact quite different. Search engines may regard them as different URLs altogether. As a result, some pages may get indexed under the www version, while others may get indexed under the non-www version. One way to ensure that search engines will only index one version is by adding the following rule into your .htaccess file:
RewriteCond %{HTTP:Host} ^domain\.com$
RewriteRule (.*) http://www.domain.com/$1 [QSA]
With that rule in place, when the non-www version of the site is requested, the user will be redirected to the canonicalized www version. It should be noted that this rule will not just work for the homepage, but all pages within that domain. For example:
domain.com/page1.htm
… will redirect to this…
http://www.domain.com/page1.htm
As you can see, that rule is pretty powerful. In a future post, I will demonstrate how the .htaccess file can be used for page level redirects.
Posted in SEO & Web Development
Sometimes you may have certain pages on your website that you do not want indexed by search engines. Just recently, we developed an online order form for a client that should not show up in search engines. To ensure that a page does not get indexed or crawled by search engines, it is important to do 3 things:
1. Add a rule in your website’s robots.txt file. Assuming the page you don’t want indexed is order.htm:
User-agent: *
Disallow: /order.htm
2. Add a “noindex, nofollow” robots meta tag in the head section of the page that you don’t want indexed or crawled:
3. For each link leading to the page that you don’t want indexed or crawled add the following “rel” attribute to the anchor tag with a value of “nofollow”:
That’s pretty much it. It should be noted, that until recently, it was thought that you only had to add the rule to your robots.txt file to prevent pages from being indexed and crawled. However, Matt Cutts from Google gave some insight stating otherwise in a video posted on his blog (http://www.mattcutts.com/blog/robots-txt-remove-url/).
Posted in SEO & Web Development
One of the many items we look for in our website Optimization Reviews is whether or not a website is using JavaScript flyout menus. JavaScript dependent flyout menus are not ideal navigation solutions for a number of different reasons. First and foremost, search engines cannot crawl JavaScript menus. This means that if you are relying on a menu system for users to find certain pages, while they may be able to, search engines will not. JavaScript menus also contribute to a page’s code bloat, by automatically adding numerous lines of irrelevant code to a page’s HTML output. Additionally, if a user has JavaScript turned off on their web browser, whether intentionally or not, not only will the search engines not be able to see the navigation, but neither will the user.
It just so happens that the most widely used menu system that we come across is the one that comes bundled with the most popular web development application, Adobe Dreamweaver. While this menu system is very easy to setup, style and implement, it’s a JavaScript menu. An alternative to JavaScript dependent menus would be a menu that is created using a combination of Cascading Style Sheets (CSS) and jQuery (a JavaScript). CSS and jQuery navigation systems will perform just as well, if not better, than a pure JavaScript menu and they are 100% SEO friendly. Also, if the user has JavaScript turned off, then the menu will degrade nicely to pure CSS.
If you are concerned about SEO and are considering using flyout menus on your website, then it is important to explore non JavaScript dependent menu systems so that your site can easily be crawled by search engine spiders.
Posted in SEO & Technology