Subfolder install - external links get changed/redirected to site relative links

subfolder

(Vincent) #1

Hi

I just migrated our discourse install from a subdomain to a subfolder. Yes, I know it’s not recommended, however we saw a significant (50%) drop in organic search traffic after moving our forums (and we’re sure there is no other cause).

So after a lot of messing about I have it working well, however all external links in posts are broken.

The links all render correctly, and the html markup is correct, but for some reason link tracking is changing to be link relative to our site.

The discourse install is setup behind an IIS reverse proxy with the following rewrite rule

<rewrite>
  <rules>
    <rule name="discourse Reverse Proxy" stopProcessing="true">
      <match url="(.*)" />
      <action type="Rewrite" url="http://discourse/{R:1}" />
      <serverVariables>
            <set name="HTTP_X_FORWARDED_HOST" value="www.finalbuilder.com" />
            <set name="HTTP_X_FORWARDED_PROTO" value="https" />
            <set name="HTTP_X_REAL_IP" value="{REMOTE_ADDR}" />
      </serverVariables>
    </rule>
  </rules>
</rewrite>

I have done all the remapping etc suggested in https://meta.discourse.org/t/subfolder-support-with-docker/30507 and I’m not seeing any 404s or other errors.

Is there something else I need to do for external links to work correctly?


Image lightbox not working in subfolder install
(Vincent) #2

OK, answering my own post as it might help someone else.

The answer (or at least, something that appears to work) is to uncheck the “Reverse rewrite host in response headers” in Application Request Routing on IIS

ReverseRewriteHost

I’m not 100% sure this is the correct way to resolve this, as I have a feeling it may break internal redirects? I suspect I might need to use an outbound rewrite rule to handle this.

I’ll keep investigating this, if I find another/better way I’ll post back here.


(Jeff Atwood) #3

You are opting in to a whole world of pain and suffering here.


(Vincent) #4

Moving our forums out to a sub domain caused us major ranking issues, and resulted in a dramatic loss of organic search traffic. I knew about the whole seo subdomain vs subfolder issue before we made the move, but thought it was a bit exaggerated. We were desperate to replace our old forum software as it had major issues (zero ability to deal with spammers, mangling content etc) so we took a punt - sadly my worst nightmares were realized :

The above graph is from google analytics, looking at organic traffic to the forums - we switch to discourse on sept 11th. I gave it a while to see if it would recover on it’s own, and spent a lot of time making sure GA etc was setup correctly (it is).


(Jeff Atwood) #5

Did you have redirects set up properly? Our migrated customers don’t have this experience, so it is likely something wasn’t right in the setup.

I think your subfolder suffering has only begun, as far as troubleshooting and issues. There is a reason we only do this when held at gunpoint paid substantial amounts of money.


(Vincent) #6

Yes, redirects were/are setup correctly and were working fine (and were tested regularly, especially once we noticed the organic drop off).

As for suffering, well that was certainly the case over the last day or so, it all seems to be working quite nicely now.

It’s running as a subfolder under a dotnetnuke 9 site (don’t laugh, we’ll move off that eventually too once we redevelop our store) , with single sign on working well (I had to write a dnn extension).


(Stephen) #7

In the past five years not one of the communities we’ve worked with has seen any SEO hit as a result of the above. Google has publicly stated that subfolder vs subdomain has no impact on SEO, something that Jeff has also reached out and had confirmed directly.

You’re wasting your time creating complexity here rather than identifying and fixing the real issue, and as it has been more than a month Google won’t magically “turn the faucet back on”.

Proxying Discourse through DNN and IIS is going to murder your TTFB, which will have more of a negative SEO impact on top of whatever you did back in September/October.


(Jeff Atwood) #8

This is not entirely true, there is usually a natural drop off when you migrate a community due to the change in URLs and reindexing content in a new format. But things come back after a while if you give it 6 months or so, and then go back upward — because you are replacing a very old and busted software with something that’s actually pleasant to use on a smartphone, tablet, and laptop.

Discourse is also way more crawler friendly than old forum software.


(Vincent) #9

Was it a coincidence that we saw such a massive drop within weeks of migrating from a subfolder to a subdomain. Quite possibly, but look at from my point of view. What did I change, what can I control (since I can’t control what google do). I’m desperate to reverse the trend, if the subfolder makes it worse we’ll revert to a subdomain. Yes, I know google have stated it makes no difference, but then people have cited tests that dispute that claim, and without any evidence of other factors that would have caused this on our site, I’m skeptical at best.

It’s not proxying through DNN, it’s proxying through IIS. And our TTFB is no worse than these forums :

Pagespeed for this topic

Score - 29

Pagespeed for a topic on our forums

Score - 30

I have no doubt that discourse is more crawler friendly, it’s more everything compared to our old forums :grinning:


(Stephen) #10

What kind of redirects did you put in place? Type, quantity, granularity, etc.


(Vincent) #11

Almost every topic from the old forums

/support/forums/aft/123 <<old forums
redirects to 
sub.domain.com/t/what-ever/4545

using 301 redirects

6000 topics.