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

XF 1.5 URL to User Profiles Wrong - Sometimes

#1
Google Console is reporting that some links to my user profiles are wrong in XenForo.

Our forum user profile pages are at www.domain.com/interact/members/user-profile.929292

Some links to that users profile are reporting as www.domain.com/members/user-profile.929292

I found by viewing source that the URL to the user profile is different on the same page. I don't know if this is the problem?

Here's a quick 1 minute video explaining:




PS: If the differing URLs is not the problem, do you know where Google Console is getting this incorrect URL from?

Thanks
 

Chris D

XenForo developer
Staff member
#2
The important thing to note is, after finding the thread in your video, all of the URLs, regardless, work correctly.

The links that begin with members are perfectly valid because if you look further up the source you will see a "base href" which points to <domain>/interact/ which means that URLs will be treated as relative to that (so members/blah.123 becomes /interact/members/blah.123).

The other variant of the URL specifically comes from the "My Regimen" links you have. I'm not sure if this is an add-on or a custom field or some such but ultimately it looks like it's outputting /interact/ at the start of the link whereas it doesn't really need to.

I'm not certain, however, if Google Webmaster tools is flagging these links specifically as being problematic as they clearly work. If you have only recently moved into the /interact directory then there may just be some stale records in the index and over time these will update correctly as Google and others crawl the page.

If you don't already have it set up, ensure you have XML sitemaps being generated and being pinged to Google and Bing as this can sometimes expedite the process of updating such things.
 
#3
We've always been at /interact and XML sitemaps are being generated and updated hourly.

My developer said this as another possible cause:

"Something is wrong with settings for tablets. This improper URL without /interact/ is appearing when width of screen is between 611px - 1024px, which is typically the setting for tablets"


I'm not certain, however, if Google Webmaster tools is flagging these links specifically as being problematic as they clearly work.
If they are correct and they work, then they are not what Google is finding. Its always a hunt to figure out exactly what Google is seeing. And where its seeing it.
 
Last edited:

Chris D

XenForo developer
Staff member
#5
Well, this is where you need to direct your attention:
The other variant of the URL specifically comes from the "My Regimen" links you have. I'm not sure if this is an add-on or a custom field or some such but ultimately it looks like it's outputting /interact/ at the start of the link whereas it doesn't really need to.
The "problem" URLs are specifically related to whatever adds the "My Regimen" section in the message user info. Is this a custom field? An add-on? That's basically where you need to start debugging this as it's only that which is generating the different URLs.
 
#6
You were right!

But how did you know they were problem URLs if they were working correctly?

It had an "unnecessary" /interact/ in there but it still worked when you clicked it.

So this was the problem:

And this is totally weird. Its the "My regimen" button, which has an HREF around it, which you pointed out is correct.

But when the display size gets below 611 for tablets, etc ... the HREF "goes active" and it drops the /interacct /............. leaving domain.com/members/

The interact is dropped. Very weird.

Anyways thank you!
 
Last edited:
#7
it was in the member_user_info template

<xen:if is="{$user.customFields.regimen}">
<a href=“/members/{$user.username}.{$user.user_id}/" class="username regimen regimen-mobile-landscape" dir="auto" itemprop="name">My Regimen</a>
</xen:if>

That’s how it was before

<xen:if is="{$user.customFields.regimen}">
<a href="members/{$user.username}.{$user.user_id}/" class="username regimen regimen-mobile-landscape" dir="auto" itemprop="name">My Regimen</a>
</xen:if>

And after the fix.

That one slash caused 307,000 404's in our Google console :)
 

Chris D

XenForo developer
Staff member
#8
I recommend changing it to the following:

Code:
<xen:if is="{$user.customFields.regimen}">
    <a href="{xen:link 'members', $user}" class="username regimen regimen-mobile-landscape" dir="auto" itemprop="name">My Regimen</a>
</xen:if>
This uses the XF link builder. If, for any reason, you ever change your URL, then it will ensure the URLs update automatically.
 

Chris D

XenForo developer
Staff member
#12
Looks like it still has the same problem as before.

Code:
        <h3 class="userText">
            <div class="uix_userTextInner">
               
               
               
                <a href="members/mynamedoesntmatter.128515/" class="username" dir="auto" itemprop="name">Mynamedoesntmatter</a>
                <em class="userTitle" itemprop="title">New Member</em>
               
                    <a href="/interact/members/Mynamedoesntmatter.128515/"  class="username regimen regimen-mobile-portrait" dir="auto" itemprop="name">My Regimen</a>
               
            </div>
           
           
            <!-- slot: message_user_info_text -->
        </h3>