Redirect wildcards to a single root directory

When you want to redirect a bunch of possibilities to one path and you want that path to return the default file (index.php, index.html ...) but for SEO reasons you just want to point to the root of the directory, not the default file, use something like this in .htaccess

# Redirects any request to directory
RedirectMatch 301 ^/.*$

# Redirects any request for /foo/* to directory
RedirectMatch 301 ^foo/.*$

Drupal header logo SEO markup

The default Drupal header markup for the site logo is horrible SEO... it just plain misses a great opportunity.
The original code , usually in the page.tpl.php looks like this:

<a href="/" title="Home" rel="home" id="logo">
          <img src="" alt="Home" />

Improved version of the code:

Alt attributes on links (just say NO)

I have run into many instances in our sites, especially on grid templates where alt attributes are being set in a link option. This should not be happening. There is NO alt attribute for anchor tags. Only img tags have alt attributes and they should/must be used.

This is an example of BAD code [The link has an alt, but the img does not.]

SCHEMA Microdata tools

This markup tool for Schema tags allow you to pass it an url of an existing page, then highlight data on the page and identify what it is. When you are done You can view your existing html with the schema content added and highlighted for you.

Canonical URLS in Drupal

By default, Drupal will insert a <link rel="canonical"> tag in the head of each page on your site. The problem is Drupal inserts a relative URL rather than a more helpful absolute path. The other issue, is if you have a mobile version of the site, you need to account for that too.


Remove default Drupal canonical tag. Add this code to template.php:

Subscribe to RSS - SEO