1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Change "forums" route to "view"

Discussion in 'Add-on Releases [Archive]' started by Jake Bunce, Nov 11, 2011.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    As the title says...

    For example, this URL:


    Is changed to this:


    This is a popular request from people who install their forum into a directory named forums/ because you get a doubling in the URL like this (directory + route):


    It is strictly a matter of URL beautification. The double "forums/forums" is functionally OK but some people don't like the way it looks and would prefer to change it which is what this addon does.


    Note - this addon creates a new route called "view" which simply points to the handler for the default "forums" route. But all templates and other code employing link syntax can and should continue to use the "forums" route internally. This addon intercepts all "forums" links and changes them to "view" so you don't have to change any links in the templates and files. This also means you can disable or uninstall this addon and all links will revert back to "forums".

    Redirects are automatically handled as well. If you install this addon and then try to access a "forums" link it will redirect you to "view". But the redirect doesn't work going backwards if you uninstall this addon. If you wish to preserve "view" links in the event of uninstalling this addon then you can enable debug mode and recreate the "view" route:

    Admin CP -> Development -> Route Prefixes -> Create New Route Prefix

    Screen shot 2011-11-10 at 6.20.32 PM.png

    I tested this in both 1.0.x and 1.1.x

    Attached Files:

    erich37, qwil, mthien and 20 others like this.
  2. DeltaHF

    DeltaHF Well-Known Member

    A very elegant solution to a very annoying issue. Thanks so much! :)
  3. Brett Peters

    Brett Peters Well-Known Member

    Thanks Jake this is awesome (y)
  4. M@rc

    M@rc Well-Known Member

    Yes, yes it is, ;) Thanks Jake.
  5. Reeve of Shinra

    Reeve of Shinra Well-Known Member

  6. Brett Peters

    Brett Peters Well-Known Member

    Thanks again Jake, I ended up renaming a few things to also change "threads" to "viewing" which I wouldn't have been able to do from scratch.
  7. Trover

    Trover Member

    I've been looking for something like this for a while. thanks!
  8. Brogan

    Brogan XenForo Moderator Staff Member

  9. DRE

    DRE Well-Known Member

  10. Trekkan

    Trekkan Well-Known Member

    Thanks Jake, works perfectly. =)
  11. Digital Doctor

    Digital Doctor Well-Known Member

    Cool tweak.

    This ongoing issue could be solved by giving future xenforo users "Tips" in the installation instructions about this problem. :(
  12. Itworx4me

    Itworx4me Well-Known Member

    I am getting this error when trying to install this addon: Please enter a valid callback method.
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Make sure you uploaded the files first before importing the XML.
  14. DRE

    DRE Well-Known Member

    I honestly should've changed my forum folder name to boards instead of the name forums. How bad would google penalize me if I changed it to boards and uninstalled this modification?
  15. Itworx4me

    Itworx4me Well-Known Member


    Do you see any repercussions if I were to change threads to use the view prefix?

  16. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is no penalty if you redirect the old traffic to the new location.

    That's fine. You can modify this addon to extend the thread route instead of the forum route.
  17. Itworx4me

    Itworx4me Well-Known Member

    Jake is it possible to have view as the forums and threads prefix? I tired but it over wrote the view forums to view threads. Says you can only have one unique prefix. Can there be Two or maybe Three?
  18. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    They need to have different routes. They can't both be "view".

Share This Page