Download our 34+ FREE plugins for WordPress!  Click here

Trailing slashes are being forced into my URLs?

Traditionally, trailing slashing a good idea for website structure because it meant micro-second faster loading speeds for servers, as they didn’t have to check whether a page was a directory first. These days, especially with Nginx servers, its not so relevant anymore, however trailing slashes are more just a good idea for usability and clarity. For example, it helps users and software understand that a URL is “complete” when the trailing slash exists.

When LittleBizzy migrates new clients to our hosting environment, we enable the “forced” trailing slashes on all URLs when we notice that a customer’s WordPress website does indeed use trailing slashes. This is done via a one line rule on the Nginx server block:

# rewrite ^([^.]*[^/])$ $1/ permanent;

However, we have learned over time that while this rule can be VERY good for SEO, as sometimes 3rd parties will link to your site incorrectly and Google bots get confused and/or index multiple versions of the same page, it also can BREAK certain websites. Specifically, we have noticed that it can break sites running bbPress or BuddyPress, as traditionally those softwares didn’t have trailing slashes in their URLs. Now they have trailing slashes, but they are more like “pseudo” trailing slashes and so the above Nginx rule can break their functionality. We are still learning what other situations this rule can cause problems for, but right now it seems like a good idea in 99% of situations.

If you DON’T want this functionality, simply consult with our support team to get it turned off for your VPS.

Last modified:  2 Oct, 2015
http://bizzy.in/1PRPH9B