Tutorial for setting up custom permalink structure in WordPress

Changing the permalink structure of my posts had been on my to do list for my WordPress based Rotheblog for quite some time, if not a month after I launched the redesign. I knew my apache server was configured with mod_rewrite available, so I didn’t have to worry about my server not supporting permalinking.

Short Sidebar

Don’t know if your server supports permalinks?

In your .htaccess file put this line of code;

RewriteEngine On

If the engine is not turned on, usually you will get a 505 error screen under certain configurations of Apache. If you don’t get an error, the engine is probably on.

I thought you might be able to figure this out by using phpinfo();, but that was the designer in me not understanding that that function is for php and you are looking for an apache config in httpd.conf.

I had tried setting permalinks up once before, updating my permalink structure in the admin control panel interface, but unsure what to do next as my website links were broken. I thought maybe I had to give my .htaccess certain permissions to allow the system to write the rules to it, but I didn’t make time to explore it in depth. WordPress should update that .htaccess file for you when you change the structure, but double check. Download the file yourself and look.

Turned out today, I tried again without exploring much more in depth, and got permalinking to work. I was nervous, not completely understanding the mod_rewrite engine, that any dynamic links pointing to my site would now be broken. But, the rewrite works on those links, no matter where they are.

Originally, my links were the default, and looked like this;

http://www.rotheblog.com/?p=1606

I added these rules to my Options > Permalinks > Custom Field

/%post_id%/%postname%

This will use the unique post id and then add it to the slug name of the post, which is dynamically generated from the title of the post. (Or it can be entered manually) My links will now look something like this;

www.rotheblog.com/1611/enabling-setup-permalinks-structure-wordpress

Then, all I did was download my empty .htaccess file from the server, and add these rules to it, and publish;

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

I found that these two sites were all I needed to setup my permalinking structure

  1. WordPress Codex
  2. Perishable Press

Now, I can have those keyword rich search engine friendly link titles available to use to my advantage.

For those of you who zoned out in the first sentence and are asking, “How does this affect me?” It doesn’t. It just means that my blog should be a touch easier to find in Google now that the link structure isn’t a variable name anymore.

Questions? Having issues yourself on how to setup your own permalinking structure? Leave a comment and I will help you out as best I can. If I can do it, so can anyone else.

Here are some similar arcade posts

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

Your email address is never displayed and cannot be spammed. If your comments are excessively self-promotional you will be banned from commenting. Read our comment privacy policy.

(required)

(required)