XF 2.0 How to force a url

Matt C.

Well-known member
How do you force a url? I have actionPatchNotes, and I want the route to be patch-notes, but patchnotes, and patch_notes also work. How would I force patch-notes, if someone uses patchnotes or patch_notes?

Thank you.
 
Last edited:
Go to Setup -> Route filters. Hit the "Add route filter" button and fill out the fields. In your case, "Find route" would be "/actionPatchNotes" and "Replace with" would be "/patch-notes" (note, adjust for whatever the real URL is... I suspect that "actionPatchNotes" should actually be "/pages/actionPatchNotes"?)
 
Go to Setup -> Route filters. Hit the "Add route filter" button and fill out the fields. In your case, "Find route" would be "/actionPatchNotes" and "Replace with" would be "/patch-notes" (note, adjust for whatever the real URL is... I suspect that "actionPatchNotes" should actually be "/pages/actionPatchNotes"?)

Thank you, but this is in an add-on. This is unrelated to node pages.
 
Here's an example of the canonicalization concept in threads. Adapt it to suit:
Code:
$this->assertCanonicalUrl($this->buildLink('threads', $thread, ['page' => $page]));
 
Here's an example of the canonicalization concept in threads. Adapt it to suit:
Code:
$this->assertCanonicalUrl($this->buildLink('threads', $thread, ['page' => $page]));

Thank you Mike, that worked beautifully.
 
Back
Top Bottom