BlogJet Blog

How to switch to Google-optimized permalinks in WordPress

Darren Rowse wrote today the points he extracted from interview of Performancing with Matt Cutts, Google engineer, where he talks about optimizing blogs for search engines.

The first point was “I wouldn’t bother with year/month/day in blog urls; I’d just use the first few words from the title of the post in the url”.

Great. Now, what if your blog already uses year/month/day in URLs? If you change it, you’ll lose all your permalinks.

I have the solution. Here’s how to switch to example.com/postname.html permalinks AND keep the ability to use old names like example.com/2005/12/13/postname/.

  1. Download and open your .htaccess file and remove lines “# WordPress BEGIN” and “# WordPress END” (so that WordPress can’t change your .htaccess file).
  2. Add this line: RewriteRule ^(.*).html /index.php?name=$1 [QSA,L] at the end before </IfModule>.
  3. Upload .htaccess back to your server.
  4. Login to WordPress, click Options > Permalinks.
  5. Replace your current Structure with  /%postname%.html
  6. Download and open your .htaccess again and remove all the lines starting from “# WordPress BEGIN” to “# WordPress END”.
  7. Upload .htaccess back to your server.

Done! Now you can access you posts by entering old permalinks, and new permalinks will be in example.com/postname.html format.

Tags: