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

XF 1.1 Change /forums/

Discussion in 'XenForo Questions and Support' started by Skyrie, Dec 24, 2011.

  1. Skyrie

    Skyrie Member

    How would I go about changing the /forums/ part of the hyperlink to something else (such as /boards/)? My forum is hosted on a subdomain on my website (forum.mysite) so it looks strange having the world forum appear twice in the hyperlink.
  2. James

    James Well-Known Member

  3. Skyrie

    Skyrie Member

    Thanks for the link, but is there a way to do it by editing the files themselves? If someone can give me a list of what files need editing I can take it from there. If not I’ll have to use the plugin.
  4. Lycaon

    Lycaon Well-Known Member

    Using a plugin is better.

    If you edit the files there's a strong chance your changes will be overwritten when you upgrade.
  5. James

    James Well-Known Member

    Using the plugin is probably safer. All it does is changes the route, there's no downside. You can change the /view/ route yourself to any other route by changing the $outputPrefix in the files.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That addon does two things:

    1) It modifies the output of the forums route when building a link. This can also be done by editing the library/XenForo/Route/Prefix/Forums.php file.

    2) It adds a new route for 'view' that points to the existing 'forums' handler. New routes are created through the Development tab in the Admin CP (which that addon has done for you). I am sure this can be done with a file edit but I have never attempted it. And there is no reason to do this with a file edit since an interface has been provided in the Admin CP.

    An addon is the best way to handle this.
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There are actually two changes if you want to use a route name other than 'view':

    1) Edit the library/ChangeForumsRoute/ForumsRoute.php file:

    class ChangeForumsRoute_ForumsRoute extends XFCP_ChangeForumsRoute_ForumsRoute
    	public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
    		$outputPrefix = 'view';
    		return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
    2) Edit the route prefix in the Admin CP:

    View attachment 21191
    Doctor, Veer and James like this.

Share This Page