Fixed Inconsistent 404 behavior with ending slash in /tags route

Affected version
2.1.3

Lukas W.

Formerly katsulynx

Probably the same as here.
 

Skyrider

Member
It's not just /tags though, it also happens with addons from what I can see:

website/steam/active-players

Doesn't work, while:

website/steam/active-players/

does.

I know this is an addon and not official. But why does the forum core care so much for a simple slash at the end?
 

Stuart Wright

Well-known member
This is a very serious bug.
For people migrating from XF1 to XF2 where the XF1 link worked and has been indexed by Google, but the XF2 version throws a 404, this is going to very negatively affect someone's Google reputation. Suddenly having lots of broken links is very bad.
The second result is
For our editorial addon which uses the /tag/ route, existing tags indexed by Google like this without the trailing slash are broken.

The tag name isn't a sub-route at all - it is just a parameter and should be have as such.
The route filter admin function doesn't work to fix this.
My coder @tiredjohn is working on a quick fix, but this really does need to be addressed in Xenforo.
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.5).

Change log:
Changes to allow certain URLs which do not have a trailing slash to work in a more predictable way.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 

Skyrider

Member
The changes have been rolled out here if you want to test them.

To demonstrate the fix more clearly...

XF 2.1.4:
http://1c25e54a9cf83044.demo-xenforo.com/214/index.php?tags/php - Results in a 404

XF 2.1.5:
https://xenforo.com/community/tags/php - Loads correctly
@Chris D

I assume this is only fixed with core slash routes? I just updated and it seems to work nicely for tags. But If I would for example be using the Steam plugin and use:

https://xx.xxxx.com/steam/active-players/ <- this works
https://xx.xxxx.com/steam/active-players <- this does not, results in The requested page could not be found.

I'm still curious as to why Xenforo cares about ending slashes so much. Usually any site (all sites in general I mean) would just work without the ending slash.
 

Chris D

XenForo developer
Staff member
The trailing slash is the difference between whether it is routed a controller action or actually looking for an item of content.

So tags/sometag actually implies that you are looking for a controller action called sometag on the tags route, but tags/sometag/ actually implies you are looking for a tag named sometag.

We made a change - which should apply to any route - that means if it cannot find an action called sometag then it will retry to route it to some content called sometag instead, but if that doesn’t get found it will reply as if the action cannot be found.

If it isn’t working in this particular case then we’d need to investigate further.

We would likely need you to submit a ticket from your customer area with access details. Ideally we’d need admin and FTP access (or cPanel access if easier).
 

Skyrider

Member
Thanks for your reply :)

Thus far with all add-ons that contains a link on the main forums that I have installed, the steam addon is the only one that has the tags route issue. Would it be okay for you if I create an empty test forum and share the info through ticket with the steam addon installed that has the issue?
 
Top