admin php options groups basicboard

XF 2.0 Route doesn’t work without trailing slash

Rayman

Member

I am not sure if this is a bug or not. When I go to /myroute/slughere/ it works fine (displays the page), but when I remove the trailing slash, it doesn’t work (e.g. /myroute/slughere), it says «The requested page could not be found. (Code: invalid_action, controller: My\Addon:MyPage, action: SlugHere)».

admin php options groups basicboard

Any help would be appreciated.

admin php options groups basicboard

Chris D

XenForo developer

Yep, pretty much expected. The same will happen in some cases in XF1 too.

The XF link builder will always build the correct link, though, so as long as your users aren’t likely to go around manually typing URLs or removing trailing slashes from otherwise valid URLs you should be ok.

Rayman

Member

admin php options groups basicboard

Lukas W.

Well-known member

Rayman

Member

I agree with this, although that there are sometimes ‘quirks’ in code, this shouldn’t really be an acceptable one imo.

I will have to see if there is a way around this through htaccess for any addons that use a route, but I am still curious as to how default XF2 routes add the trailing slash automatically when it’s removed.

Chris D

XenForo developer

It’s specific to routes that have a string parameter. e.g.

admin.php?options/groups/basicBoard/ will work

admin.php?options/groups/basicBoard will not work

It was the same in XF1 too.

Can you explain how in real usage this would actually pose a problem?

admin php options groups basicboard

Lukas W.

Well-known member

@Chris_D as mentioned here, someone seems to have stumbled across this issue while developing XF2 as well.

On the other hand the question is also what the benefit of not «fixing» this is. Build two different pages, one ending with a trailing slash and the other one without one seems pretty pointless to me. This is even more confusing than leaving one leading to a 404 page.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *