June 12th, 2010 // One Comment

Photoblogs can increase the chances of ranking blog posts in search engines simply by integrating keywords into the URL structure of the blog. URLs are the second most important thing on blog posts (#1 being the title) that search engines look at to figure out if your post is worthy of a rank.

WordPress Permalink URLs

WordPress makes it easy to get additional keywords into your blog post URLs by editing the permalink structure. Permalink just means the permanent link or URL location for a blog page/post. Here are some of the ways a blog will generate the permalink structure for a blog post:

Default myblog.com/?p=123
Day and name myblog.com/2010/05/23/post-name.html
Month and name myblog.com/2010/05/post-name.html

No post keywords are used in the default slug (the end of the URL), and numbers meaningless to search are used in the paths of the other two. Ideally the URL would include quality keywords in the path and the slug.

To change this in WordPress go to Settings > Permalinks and select the radio button for custom structure. Enter one of these:

/%category%/%postname%/
/%postname%/

The first one puts the post’s first category name into the URL path and the second one doesn’t. For example if your post was in a blog category called weddings, the URL would look like this:
myblog.com/weddings/my-great-wedding-post.html

Categories are a cool way to integrate keywords into the URL without having to think about it.

The only problem with changing the permalink structure is that all the URLs in the blog change. Links within your blog should continue to work, but anything linking to your old locations (like from other sites) will be broken. Thus, all the link building efforts you established to your photoblog appear to not work when Google finds them and you don’t get credit for the link.

About htaccess Files for WordPress

To avoid broken links you need to upload a file, called an .htaccess file, to your FTP server telling it the old URL and the new URL for each post on your blog.

In the htaccess file you will specify the old and new URLs like so:

Redirect 301 /oldpost.html http://www.myblog.com/newpost.html
Redirect 301 /oldpost2.html http://www.myblog.com/newppost2.html

At the bottom of the file you may need to add some general WordPress code that looks like this. You only need to add this if the only thing on your domain name is the blog, and the blog is NOT an extension of your main website (like mysite.com/blog).

AddType x-mapp-php5 .php

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

# END WordPress
Create an htaccess file for your Photoblog
  1. Download my text file to use as an example
  2. Open or paste this into a plan-text editor like Notepad and update the old and new URL locations at the top
  3. Remove the WordPress block of code if your blog is in a folder of your website, like /blog
  4. Save the file as .htaccess – that’s it, the final name of the file is just plain old .htaccess with nothing before the period and no .txt or anythinghtaccess screen
  5. Upload it to the root level of your FTP server (after you have changed the permalink strucutre in your WordPress settings)
Tips and Recommendations

Hint: the easiest way to get the old URLs for all of your posts is via the sitemap file in Google Webmaster Tools.

You might want to experiment with the file before trying to add 500 redirects. If all you did was replace myblog.com in my example with your real blog URL, then you should be able to /oldpost.html and it will redirect you to /newpost.html. Nothing would be there, but at least you would know your htaccess file is working correctly.

Thanks to WebWeaver’s article for helping me to figure this stuff out for my own blog. I hope the information above gives some direction, but I won’t be answering any questions or providing support for blog redirect files.

8/27/10 Update

If you install the W3 Super Cache plugin from Joost, you can access the htaccess file directly within the plugin. Then just add some lines at the top for the pages you want to redirect:
Redirect 301 /old-url-path/ http://website.com/new-url-path/

It may also be worth checking out the Redirection Plugin. I have not attempted (yet) but hear it can automate the process.

Related Posts:


Tags: , , ,

One Comment → “PhotoBlog Permalink Redirect URLs Using htaccess”

  1. [...] posts, so anyone linking to them from outside your own blog will get broken links. Read my post PhotoBlog Permalink Redirect URLs Using htaccess on how to avoid [...]


Leave a Reply