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

XF 1.2 Can you change the forum url and root path?

Discussion in 'XenForo Questions and Support' started by Razasharp, Sep 27, 2013.

  1. Razasharp

    Razasharp Well-Known Member

    I have installed XF in the root directory at mysite.com, however I would like the forum homepage to be set/accessible via mysite.com/forum and I want the root of the domain, mysite.com to display a XF page or thread.

    Is this possible?
  2. Jeremy

    Jeremy Well-Known Member

    Yes, set your home page route in your options. You'll need a route changer to make forums -> forum
  3. Razasharp

    Razasharp Well-Known Member

    Do you mean 'Board URL' or Home Page URL? (I want the homepage of the site to still be at mysite.com - I just want it to silently display a XF page or thread).

    Adding a route changer as you describe just changes the part of the url when visiting a section, eg, mysite.com/forum/general-chat.2/ (and when you remove the last part of the url so the remaining bit is mysite.com/forum, it just goes to mysite.com)

    The end result I am looking for is:

    mysite.com - displays a XF page of my choice (but the URL stays the same)
    mysite.com/forum - becomes the default forumhome page (a bit like how we could rename index.php to any name of our choice in vB)
  4. Jeremy

    Jeremy Well-Known Member

    No, you need to set your index ("home page") route in your options.

  5. Razasharp

    Razasharp Well-Known Member

    I don't want to change the page itself tho, I still want it to be the default XF forumhomepage - I just want to change the location so that it is at /forum (but obviously without having to install XF in a /forum directory)
  6. Jeremy

    Jeremy Well-Known Member

    The way you just described is not the way I gather it working.

    If you set the option as I'm advising, your home page (mysite.com/) will display that page. The forums will then be accessible at forums/ (mysite.com/forums/). If you want it to be /forum/, you'll need to use a route filter (route changer I mentioned earlier) to translate forums -> forum.
  7. Razasharp

    Razasharp Well-Known Member

    Do you mean change 'Home Page URL' - that only changes the link from what I can see, and does not have any impact on what's at mysite.com.
    Currently when someone goes to mysite.com it shows the XF forumhome page. What I want is for it to show some other page (eg a thread or a XF 'page' that I will create later)

    I've added a route, /forums -> /forum, but going to mysite.com/forum just redirects to mysite.com

    Also are these routes cached? I've cleared out all the old settings but they seem to be persisting, even though they do not show in the ACP :/
  8. Jeremy

    Jeremy Well-Known Member

    The option right above home page URL... Called "Index Page Route" with the description I quoted above.
  9. Razasharp

    Razasharp Well-Known Member

    Right ok... think it was some weird caching problem with Safari.

    However I have a new problem..

    Currently I have 'forums -> my-forum' as a route because I wanted the forum to be accessible at mysite.com/my-forum. This now works.

    But I want the actual forum sections to go from the 'forums' route to 'section'. But if I do that then my forum is accessible at mysite.com/section which is not what I want.

    For some reason the 'forums' path is tied into a forum section and the forumhomepage, is that right? If so any way around it?

    I appreciate your help btw :)
  10. Mike

    Mike XenForo Developer Staff Member

    Your last message has me confused...

    The "index" page is not connected to any particular content. Technically, the forum list is accessible via forums/. The index page route option changes what is displayed at /. It is then smart enough to change any URLs that go to the index page route to just be /.

    Individual forums also go under the forums/ route, just with more stuff after it (forums/name.123/). If you specify a route filter that changes forums/ to forum/, it will change URLs to forum/name.123/ as well. There is no built in way of preventing this. (If you want to get advanced, you can write more specific route filters to only change the latter type of URL.)

    In your example, I'm confused as to where "my-forum" and "section" come in. It sounds like you're trying to set 2 different route filters to change the same thing? Only one route filter will ever be applied to a route/URL at a time.
  11. Razasharp

    Razasharp Well-Known Member

    Hi @Mike

    I think I am confusing myself too.

    This is what I am trying to achieve:

    • mysite.com - to display a XF page that I will create later (for now I have put the url of a thread in 'Index Page Route' and that seems to be working fine)
    • mysite.com/my-forum - to display the normal forumhome page (I have now got this working by creating a route 'forums -> my-forum')
    • mysite.com/section/some-forum-section - this is what I want for the individual forum sections. But I can't do this because I have already used the 'forums -> forum' route to get the forum to show at /my-forum.
    I have found a workaround that is not ideal but seems to work - I just create a new route for every forum section that I don't want to appear with the 'my-forum' part of the url, eg, 'forums/feedback.4/ -> feedback/' (I want to use this for non-forum sections, such as blogs, articles, news etc).

    So I sort of have it working now... but is that the best way to go about it?
  12. Mike

    Mike XenForo Developer Staff Member

    You should be able to do:

    forums/ -> my-forum/
    forums/{forum} -> section/{forum}

    Note that there can be a bit of a challenge with the order here if you continue expanding this with other filters. Filters are processed from the longest to the shortest (in this case, based on the find route), which generally covers most to least specific. You'll just need to check to make sure everything works as expected if you add more.
  13. Razasharp

    Razasharp Well-Known Member

    That doesn't seem to work Mike, it makes the forumhome page '/section' as well.

    I think I might be ok the way I've done it above.

    What would be really nice though, is being able to have the actual thread url include the forum too - so the threads route might be changed to something like:

    threads -> {forum}/

    So instead of a thread showing with the url: site.com/threads/name-and.34/ it would replace 'threads' with the name of the forum the thread is in. Not a big deal tho, as I imagine it might need quite a bit of reworking.

    Thanks for your help both.
  14. Razasharp

    Razasharp Well-Known Member

    Hi @Mike, is it possible to create a route for prefixes?

    I tried 'forums/{forum}/?prefix_id=5 -> forums/{forum}/have-you-seen' but it doesn't work.

    Is this something that you might be able to easily add for a future update? I am thinking about adding an XF forum on another site where this would be needed. I was actually just going to add simple Q&As to the site, but after seeing XF think it could be a perfect fit :)
  15. Brogan

    Brogan XenForo Moderator Staff Member

    I don't think route filters work with query strings.
  16. Mike

    Mike XenForo Developer Staff Member

    They do not.
  17. Razasharp

    Razasharp Well-Known Member

    That's a shame - is this something that might be easy enough to add to a future version Mike? Or would it be a pain in the butt?
  18. Mike

    Mike XenForo Developer Staff Member

    TBH, I wouldn't ever expect it.
  19. Razasharp

    Razasharp Well-Known Member

    Sorry for being a bit dim but what do you mean? That you don't expect admins would find it useful?

    I think it's a great way of easily being able to have some sort of categorisation or even sub-forums to forums without having to explicitly create hundreds or thousands manually. Eg, a car forum might have a forum section for each model, then in each they could have prefixes for 'questions' 'discussions' 'reviews' etc so could end up with URL's like:


    It would be both user friendly and good SEO.

    Does that help explain it better?
  20. Brogan

    Brogan XenForo Moderator Staff Member

    I think Mike means it's not something he would ever consider implementing.

Share This Page