Matt Farina - Tech / Faith / Life

Search Engine Optimization for Your Blog - Part 3

In

Over the past year many of my friends have setup great blogs. Not just self serving blogs, but blogs that are worthy of getting out beyond our circle of friends. One of the best ways for not only search engines to pick up on the posts better but for readers to navigate a blog better is with pretty URLs. A pretty URL is one that looks something like /2006/08/01/this-is-my-post. In drupal and wordpress this is not native. The native setup is something like ?p=120, ?q=node/120, or node/120.

What Makes Them So Great?

URLs formatted like this encourage browsing. Someone could go to the URL /2006/07 and get a list of all of the July entries. Or, they could go to the URL /2006/07/21 and get the entries for that date. Remembering the date can make it easy for someone to go back and find a post. Search engine spiders will also read these different links and lists of posts. One big plus is that a URL formatted like this is human readable.

This style of URL formatting is not just for blog posts but can, also, work for blog tags and categories. A URL like /category/apple or /tag/drupal would be better for user and search engines scouring ones site.

Setting Up Clean URLs with Drupal

Drupal calls URLs that are missing the ?q= and look like /node/120 Clean URLs. To enable this follow the instructions in the drupal handbook.

After setting up clean URLs we need to configure them to look like /2006/08/01/this-is-my-post. To do this download the pathauto module, put it in the modules directory and enable the path and pathauto modules (in admin/modules).

Once enabled we need to just setup a few pathauto settings (in admin/settings/pathauto). Under General select Create index aliases. Under Node Path Settings in the field below Pattern for all blog entry paths: put in something like "/[yyyy]/[mm]/[dd]/[title]". If you want the already existing URLs to update to this select Bulk update node paths and Bulk generate index aliases. Click Save Configuration and you're done.

If you, also, want to setup category clean URLs under Category path settings in the field for your tags or categories put in something like "[vocab]/[catpath]".

Setting Up Pretty URLs with Wordpress

The first thing to do in wordpress is to add the following code to your .htaccess file. If you are creating a .htaccess file for this make it a plain text file named .htaccess. Don't use word or rich text formatted files. They won't work.

# BEGIN WordPress
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</ifmodule>
# END WordPress

Now, upload the file to the base directory for the blog. Because of the period at the front of the name you may have to set your ftp program to view hidden files. Then select this file and preform a chmod 777 to the file. This will give wordpress the ability to modify it.

Now, login to the wordpress admin and navigate your way to Options » Permalinks. Here you will be presented with a few permalink options. The most common is date and name based. After you have selected the one you want click Update Permalink Structure. Then go back to your .htaccess file and preform a chmod 644 to protect you .htaccess file and you're all set.

Technorati Tags: , , , , ,

What language is that?

Okay, so as you know I'm redoing my site in drupal but trying to get all these details taken care of before putting it out there to the public (well, and importing my Wordpress blog into Drupal ... want to start of with the right formatting).

Anyway, that first step there where it involves following the Drupal handbook ... um, what language is the handbook in because I'm not even sure where they are starting with the instructions. What's Apache?

Apache

Apache is your webserver.... the more you read the more you will know... that kinda reminds me of a commercial from when I was a kid.

That's what I thought

Well, I was thinking that, but when I did a search on Apache from my host, it came up with nothing so I thought, hum, maybe it's something else and I missed something. Guess I'll go try and make sense of all this.

Hum

Well, I'm still not sure what I did, but whatever it was, it was right because it worked. Thanks for sending me in the right direction.

um, ok

glad I could help.. though I don't know what I said.

huh?

now i remember why i don't read your blog that often... because when i do i feel really stupid.

how did you get so fantastically geeky?

you are my friend for this very reason, so i don't have to ever try to understand this stuff :)

keep at it though, i think other people out there DO get this.