WordPress Permalinks for SEO – using Apache Mod_Rewrite not htaccess

It is optimal for SEO (Search Engine Optimization) — otherwise known as ranking higher in Google — that URL’s (web addresses) should have the same words (keywords) as the search that a person is performing.

Good background information on WordPress Permalinks can be found here in the WordPress Codex.

The problem is that by default WordPress blogs set the URL to only a number, for example


which does not really provide any information about the content of the web page.

But if you look in WordPress Settings, you will see under “Permalinks” that WordPress has five options for how to display URL’s, and the last option “custom” is the best for SEO purposes! Here is my custom WordPress Permalink setting:


This generates a Permalink URL such as:


which obviously contains a variety of keywords which will help people understand the content of that web page.

While most of the web pages about Permalink talk about utilizing .htaccess files (on a per-directory basis), it is possible to get Permalinks to work, simply by setting up your Apache httpd.conf file.

Your httpd.conf already (by default) should have the line:

                LoadModule rewrite_module modules/mod_rewrite.so

and then you need to create a section in that file to define that the rewrites will be used for your blogs:

<Directory “/var/www/html/blog”>
AllowOverride None
Allow from all
Order allow,deny
Options All ExecCGI FollowSymLinks Includes -indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

That “IfModule” section was copied exactly from the bottom of the WordPress’ /wp-admin/options-permalink.php page (which are displayed after you click “save changes”).

Don’t forget to restart Apache, set WordPress Settings to Custom, and hopefully your permalinks are now working to help improve your SEO!

NOTE: while most of the interest in WordPress concerns POSTs (blogs), WordPress also supports dynamically-created static pages (even a hierarchy of static pages). In other words, you have the option to create either posts (which are inherently chronological) or pages. The codex page is very specific when it discusses the solution to when permalinks to pages don’t work and you get a 404 error“If you’ve tried to navigate to a newly created Page and encounter an error, you likely need to update your Permalink structure. Remember, each time you add a new static Page to WordPress, new rules must be generated and updated to .htaccess (WordPress 1.X) or to the internal rewrites array (WordPress 2.X). “

(YMMV based on differences with how your server is setup)

This entry was posted in WordPress. Bookmark the permalink.

One Response to WordPress Permalinks for SEO – using Apache Mod_Rewrite not htaccess

  1. Nice post, good to see some solid SEO facts there. For me, the number one SEO factor is linking, specifically anchor text. Can’t be ignored!

Comments are closed.