Search

Remove XenForo Goto 301 Redirect Links

  • Thread starter KodyWallice
  • Start date
KodyWallice

KodyWallice

Member
Joined
May 7, 2021
Messages
123
Reaction Score
1
Points
23
  • #1
Like other users, I have noticed many 301 redirects on my XenForo forum. They're on the main forum list, on the thread lists, and on the thread pages themselves. While some of these links (most of them) are nofollow links, some are not. I can understand why the redirects exists, but I honestly don't think many people click them. I don't mind having them on my website, but I don't want the search engines to see the links. They can't be good for pagerank flow. All I want is to have a homepage, forum pages, and thread pages. I can do without all of the other random links that exist on all of these pages. It's difficult to imaging that they're not causing ranking issues.

Today I'm focusing on the /goto/ URLs that are created when a member quotes and replies to another member on a thread page. Here's an example of a quote from this forum itself:

xenforo-quote-reply-goto-url-link.gif

If you take a look at the above screen capture, you'll see the LukeLewis said link. That links goes to:

https://gaulard.com/forum/goto/post?id=74

It's redirected to this URL:

https://gaulard.com/forum/threads/38/#post-74

At first glance, you may be thinking, "That's not bad. It's just a redirect." I thought that too. But now think about a thread that's 200 pages long with 20 posts per page. That's 4000 messages in only one thread. If every one of those messages contained a 301 redirect, things could quickly and easily spiral out of control. And that's just one thread! What if you ran a forum that has 500,000 threads? Hopefully, you get my point. I don't think Google wants to spend it's time following URLs that link back to other posts in the same thread. And honestly, I don't really think humans use these links either. So instead of them being nofollowed pagerank drains, crawl budget wasters, and not really utilized, I'd rather remove the link portion of the text for visitors who aren't logged in. If someone is logged in, then fine, the links will work great. But for those who aren't logged in, I'd like to make this link regular plain text.

So my question is, does anyone know which template I need to update to remove the links? Also, does anyone know the code I need to change to make these links invisible to search engines and guests who aren't logged in as members?
 
KristinaW

KristinaW

Member
Joined
May 7, 2021
Messages
127
Reaction Score
0
Points
18
  • #2
To remove the /goto/ links, you'll need to edit the bb_code_tag_quote template. Find the following code:

Code:
<a href="{{ link('goto/' . {$source.type}, null, {'id': $source.id}) }}"
class="bbCodeBlock-sourceJump"
rel="nofollow"
data-xf-click="attribution"
data-content-selector="#{$source.type}-{$source.id}">{{ phrase('x_said:', {'name': $name}) }}</a>

Change the above code to this:

Code:
<xf:if is="$xf.visitor.user_id">

<a href="{{ link('goto/' . {$source.type}, null, {'id': $source.id}) }}"
class="bbCodeBlock-sourceJump"
rel="nofollow"
data-xf-click="attribution"
data-content-selector="#{$source.type}-{$source.id}">{{ phrase('x_said:', {'name': $name}) }}</a>

<xf:else />

{{ phrase('x_said:', {'name': $name}) }}

</xf:if>

As of this writing, the code you need to update is on line 9.
 
CampFireJack

CampFireJack

Member
Joined
May 9, 2021
Messages
118
Reaction Score
1
Points
16
  • #3
You can also just as easily remove this link altogether and replace it with this:

Code:
{{ phrase('x_said:', {'name': $name}) }}

So basically, you're stripping the link part out of it and leaving the raw text for both guests who aren't logged in as well as members who are logged in. I can't see anyone actually clicking any of these links anyway. The reason I like to get rid of them completely (for both members and guests) is so I can force any that have been indexed by Google and other search engines to return 404 pages. The way I do this is to add:

Code:
RedirectMatch 404 ^/forum/goto/.*$

to my site's .htaccess file. This line forces any url in the /goto/ directory to return a 404 header status, which will remove it from Google's index. I've played around with these useless urls for too long, trying to redirect them and block them in my site's robots.txt file. And now that XenForo has added a nofollow attribute to these urls on the thread pages, things are even worse. Any pagerank they used to transfer as a 301 has effectively been evaporated. It's best to unlink them and get rid of them all. That's my view anyway.

The same idea holds for post reactions. When someone "likes" a post, a new url is created which is useless as well. To remove these links for both members and guests, go into the REACTION_LIST_ROW template and change:

Code:
<a class="reactionsBar-link" href="{{ link($link, $content, $linkParams) }}" data-xf-click="overlay" data-cache="false" rel="nofollow">{$reactions}</a>

to

Code:
{$reactions}

And then add this link to your site's .htaccess file:

Code:
RedirectMatch 404 ^/forum/posts/.*/reactions.*$

Once you do that, any /posts/***/reactions urls that have been crawled will fall out of the index over time as well.

* This is assuming you have your forum in the /forum/ directory on your server. If it's in the root directory, simply remove the /forum/ portion from the .htaccess code I shared above.
 
Top