• 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/

#1
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.
 
#3
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.
 

Lycaon

Well-known member
#4
Using a plugin is better.

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

James

Well-known member
#5
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.
 

Jake Bunce

XenForo moderator
Staff member
#6
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.
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.
 

Jake Bunce

XenForo moderator
Staff member
#7
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.
There are actually two changes if you want to use a route name other than 'view':

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

Code:
<?php

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