• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Route Filter Not Working

kingjavo

Active member
#1
Hi,

I'm trying to change a URL to preserve SEO and redirect, instead of losing the URL altogether.

I would like the URL to go from...
simheads.com/forums/joe-montana-16-football/
to...
simheads.com/forums/joe-montana-football/

The original URL is one set in the node to be more friendly as an FYI.

When I change the Route file from...
forums/joe-montana-16-football/
to...
forums/joe-montana-16-football/

Both URLs break... can you help please!
 

Chris D

XenForo developer
Staff member
#2
Try reversing the order of the find and replace routes, e.g. (assuming there's a mistake in the above post)

Find:
forums/joe-montana-football/

Replace:
forums/joe-montana-16-football/

And check the "Incoming URL conversion only" checkbox.

I appreciate that seems backwards, but it should do what you want.
 

kingjavo

Active member
#3
Sorry, correction below...

When I change the Route file from...
forums/joe-montana-16-football/
to...
forums/joe-montana-football/

Both URLs break... can you help please!
 

Chris D

XenForo developer
Staff member
#9
No, it's correct. It seems odd, but it's right.

There's a decent explanation here:
https://xenforo.com/community/threads/route-filters.47946/

Creating aliases
Up until this point, I haven't mentioned the "incoming URL conversion only" option. I've assumed that it hasn't been checked up until now.

This option lets you allow a URL to work but it doesn't affect what's considered the canonical version. So maybe we want to have releases/114 take us to our 1.1.4 release threads/xenforo-1-1-4-released.47030/ but we want the original URL to be the real URL. We could do that by putting threads/xenforo-1-1-4-released.47030/ in the find box and releases/114 in the replace box. I'm aware this might seem backwards, but the system is written from the perspective of outgoing conversions, so find represents the URL XF is generating; the incoming conversion reverses it. It means that you don't have to swap the values in find/replace if you check/uncheck the incoming only option.