XF 1.2 Route Filters

Route Filters are a new system in XenForo 1.2 to allow you to change the standard URLs generated by XenForo, including any URLs generated by add-ons.

It's a fairly simple system to show, but it's very powerful with a little thought. Let's look at what you can set with it:

ss-2013-04-05_14-48-30.webp


Other than a list of route filters, that's really it for the system. So how about a few examples...

Changing a route prefix
There's an add-on that does this right now, but we can do it simply from here. For example, if you want to change the resources URL to downloads, you'd just enter resources/ in the find box and downloads/ in the replace box.

Instantly, any links to http://xenforo.com/community/resources/ would become http://xenforo.com/community/downloads/. URL canonicalization would still happen, but it'd use the new URLs.

So yes, if you want to change the forums prefix, you can do that.

Note that the find and the replace fields both need to start with a "prefix" (basically, alphanumeric and dash), so you can't simply remove a route prefix. Doing that would break everything. :)

Changing a more specific URL
If you want to change a specific URL--or any URL that begins with a particular string--you can do that with route filters.

Maybe you have a page with a URL like pages/page-name/ and you'd rather it be page-name/. You can do that by simply entering those in the find and replace boxes respectively.

You can even create different URLs for specific threads if you wanted to, or maybe a different URL for navigating pages in threads--find: threads/{title}/page-{num:digit}, replace: threads/{title}/{num:digit}-duplicate-posts .

While it may require a bit of manual work, you could get pretty creative with your URLs. You could even give your page URLs hierarchy, if that's how you store your pages:

pages/btcc/ -> btcc/
pages/btcc-2013/ -> btcc/2013/
pages/btcc-2013-drivers/ -> btcc/2013/drivers/
pages/btcc-2013-races/ -> btcc/2013/races/

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.



...So go wild! :)
 
please consider adding the functionality of being able to change url formats . like in vbseo. Even better whould be to be able to load the vbseo settings xml into xenforo. since importing to a fresh board doesnt change threadids then if this is implementing i am gonna buy 5 licences and convert 5 vb+vbseo to xenforo
 
I would also convert my vb+vbseo if this could be an out of the box conversion, even if it's by hand but would be superb if it would work with the vbseo setting file.
 
great stuff (y)

So is it now possible to put the RM onto the Homepage with this feature ?


:coffee:
I think not because you cannot manipulate the homepage, only what comes after it.

xenforo.com/community - cannot manipulate
xenforo.com/community/forums - can manipulate forums.

As Mike states:
To people asking what's possible, think about how it works. It works on the "route" part of the URL. Here that's the part immediately after http://xenforo.com/community/; if we didn't have friendly URLs enabled, it'd be after http://xenforo.com/community/index.php?.
You can, however, put the RM as the homepage using this method:
http://xenforo.com/community/threads/library-set-your-own-route-controller-as-homepage.10156/
 
I think not because you cannot manipulate the homepage, only what comes after it.

xenforo.com/community - cannot manipulate
xenforo.com/community/forums - can manipulate forums.
I never bothered asking this question, because I assumed you could... Maybe some clarification from the devs then. Even though there is no path, it's still using the index route, if you couldn't do resources/ -> / I was hoping resources/ -> index/ would work. Edited: Should have been the other way around.
 
I never bothered asking this question, because I assumed you could... Maybe some clarification from the devs then. Even though there is no path, it's still using the index route, if you couldn't do / -> resources/ I was hoping index/ -> resources/ would work.
Perhaps you can actually, seeing as http://xenforo.com/community/index redirects to http://xenforo.com/community/.

My bad if you can! An oversight on my part :p

Even then, if you redirect /index to /resources you'd have to set up a new redirect to access the index again, I think?
 
Even then, if you redirect /index to /resources you'd have to set up a new redirect to access the index again, I think?
Yea, most setups that do this set the new path to /forum instead for example. So resources/ -> index/ and index/ -> forum/ may work, still need confirmation though.
 
That is not the purpose of the Route Filter feature.

If you want the RM to be the landing page when people visit your site, use htaccess.
 
That is not the purpose of the Route Filter feature.

If you want the RM to be the landing page when people visit your site, use htaccess.

I believe this is broke by 1.2 :
http://xenforo.com/community/threads/library-set-your-own-route-controller-as-homepage.10156/page-4

So if I want to set a controller to my home page, I can't do it with the core route-filter, and I can no longer use the above plugin?

I literally can't upgrade one of my forums, it's such a shame that you cant set a controller to your home page using the Route Filter (I would have though that was one of the great features, not a draw back)
 
Top Bottom