WordPress Trailing Slash

Ian Hancock Development

I am now able to create this new blog after a number of hours trying to work out why WordPress wasn’t outputting the trailing slash on the post page URLs and so not allowing me to access the admin pages for the blog.

Pre updated URLs were as:


which caused a problem with our site’s mod rewrite rules and accessing the Dashboard. Adding the extra slash would solve the problem but could I find it? No.

I Trawled through the WordPress code looking to add the ‘/’ by hand to the <a> output but after tracking through about 5 PHP pages and numerous functions was unable to get to the output code I wanted. Then I stumbled across the get_permalink function and subsequently the rewrite class which mentioned the ‘permalink_structure’ option.

So, I looked in the database table: wp_options and lo, there was the setting for the link structure:

Before: /%post_id%/%postname%.htm

After: /%post_id%/%postname%.htm/

…and my post page URLs now have the trailing slash and once more all is good in the world.