XF 2.2 What is XenForo's Rule for Trailing Slashes?

⭐ Alex ⭐

Well-known member
Just curious, I'm doing research on whether or not websites should have trailing slashes or not. So far, it seems pages shouldn't end in a trailing slash, but a couple XenForo ones do and a couple don't. Is the reasoning for this, add a trailing slash if the page is for a group of something?

For example,

1698375408766.png

https://xenforo.com/community/whats-new/resources/
https://xenforo.com/community/whats-new/profile-posts/

https://xenforo.com/community/whats-new/news-feed
https://xenforo.com/community/whats-new/latest-activity
 
Solution
The ones that have a trailing slash are to the base (index) of a specific route. The URLs without the trailing slash are actions within a route. I don't have a license for the resource manager, so it doesn't show on my setup as a route. But I have these routes on my install:

1698375735449.png

So a link built to one of those "base" routes will have a slash. Any others will be the whats-new route, and then an action within the route for that controller (for example actionNewsFeed) is a controller method in XF\Pub\Controller\WhatsNew.php.
The ones that have a trailing slash are to the base (index) of a specific route. The URLs without the trailing slash are actions within a route. I don't have a license for the resource manager, so it doesn't show on my setup as a route. But I have these routes on my install:

1698375735449.png

So a link built to one of those "base" routes will have a slash. Any others will be the whats-new route, and then an action within the route for that controller (for example actionNewsFeed) is a controller method in XF\Pub\Controller\WhatsNew.php.
 
Solution
Back
Top Bottom