2

I have a main domain: example.com and a subdomain: blog.example.com that I really want combined for SEO benefit, but my blog.example.com uses PHP which is not supported by my website provider on example.com.

I thought perhaps I could move my blog.example.com into blog.example.com/info and create a robots.txt file for blog.example.com to tell search engines to not index the subdomain and then create example.com/blog as a masking redirect to blog.example.com/info. Will this cause the blog to only be indexed once by search engines and make it appear as if the blog (PHP) site is hosted under the main domain?

If not, is there another approach I could take here instead? The goal is to have the blog SEO attributed to the main domain whose hosting does not permit PHP.

5
  • 1
    What SEO benefits are you expecting to gain by consolidating your subdomains? Sounds like a lot of work, and risk, with no clear benefit.
    – Tim Grant
    Commented Dec 1, 2016 at 1:20
  • @TimGrant The main example.com domain has lots of SEO built up over time already and the blog would nicely add to that to further strengthen the domain's SEO instead of splitting it out into a separate subdomain.
    – WilliamKF
    Commented Dec 1, 2016 at 17:32
  • Subdomain and subdirectory is treated same, if you link it properly. If subdomains are not linked then Google will consider them as separate site. If you're doing for SEO benefits then I will say, don't do that. Whatever case study u have read online is does not make sense, some of them used nofollow on internal links and some of them don't link their root domain anywhere, so as usual Google will consider them as separate site. Use wayback machine to checkout their old pages, and you will see they have done many mistakes.
    – Goyllo
    Commented Dec 2, 2016 at 16:36
  • @Goyllo Sounds like the answer, can you post one and give sources to back up your assertion? Thanks!
    – WilliamKF
    Commented Dec 4, 2016 at 17:36
  • W3dk already posted the answer that fit to your question, I am just saying that, by moving your content from subdomain to subdirectory won't give any benefits as you think. Google will consider your subdomain links to your domain as internal links, so how they can treat separately?. They can treat them separately only when they consider them as external links. The simple thing is enough to understand but marketing agency make case study to confuse people.
    – Goyllo
    Commented Dec 5, 2016 at 2:19

3 Answers 3

1

...create example.com/blog as a masking redirect to ...

Yes, in theory, you can do exactly that. Note that by "masking redirect" we are not talking about "framed forwarding" or similar (which won't help at all). The "redirect" is completely "masked" from the user. The address in the browser's address bar shows example.com/blog but the server actually retrieves the content from blog.example.com/ (an additional / proxied request).

On Apache you can use mod_proxy (and optionally mod_rewrite) to proxy the request from example.com/blog to blog.example.com (a reverse proxy). However, if your current host is too restrictive (after all, it doesn't support PHP?) then this might not be possible. This is likely to require some additional config on your blog, since the base URL is now example.com/blog and not blog.example.com/.

move my blog.example.com into blog.example.com/info

Not sure why you would want to do this seemingly "additional" step? (Why /info?) You don't need to move your blog anywhere. example.com/blog would go straight to blog.example.com.

create a robots.txt file for blog.example.com to tell search engines to not index the subdomain.

You definitely must not do this! If you suddenly block the search engines from crawling the old URLs then bang goes your SEO! You will essentially be starting from scratch. Moving from blog.example.com to example.com/blog is a URL change/migration. Like any URL change you would need to setup 301 (permanent) redirects from the old to new URLs - this allows search engines to discover the new URLs where the old URLs have already been indexed. And like any URL change you might experience a dip in ranking initially. There is always a risk.

So, the basic steps involved would be:

  1. Proxy all the requests from example.com/blog/ to blog.example.com/.
  2. Change all your internal links to your new blog URL.
  3. Setup external (301) redirects from the old to new URLs. ie. blog.example.com/ to example.com/blog/.

However, I'm not convinced that "changing" the existing URL structure is going to be "worth it". As mentioned above, there is always a risk in changing the URL structure and having the blog under the same host (as opposed to a separate subdomain) may not see the SEO advantage you are seeking.

3
  • The reason I was thinking to move blog.example.com into blog.example.com/info was to create a robots.txt at the root so the site would not be doubly indexed now that the masking redirect was in place and cause SEO damage. Note the SEO on blog is minimal, but I want it helping the main example.com which has strong SEO instead of split out into a separate site building its SEO independently.
    – WilliamKF
    Commented Dec 4, 2016 at 17:38
  • If you created a robots.txt file at the root (to block what exactly?) then you wouldn't be able to "move" blog.example.com anywhere (in terms of "moving" the SEO). Any use of robots.txt in this context would seem to be SEO-shoot-yourself-in-the-foot. You prevent the "doubly indexed" with the 301 redirect (step#3 above).
    – MrWhite
    Commented Dec 6, 2016 at 23:41
  • What you are wanting to do (from the viewpoint of users and search engines) is to "change the host (ie. URL)" and the procedure is the same (steps #2 and #3 above). However, the added complexity in your case is that you aren't actually moving the files to the new host, hence the necessity to "proxy" the request (step #1 above).
    – MrWhite
    Commented Dec 6, 2016 at 23:43
0

This is quite tricky. One possible answer (I'm curious based on you've not expressed your reasons for not doing this) why not move your website over to the host that does support PHP to centralise everything?

1
  • Switching server providers for the main site is not an option at present.
    – WilliamKF
    Commented Nov 30, 2016 at 18:18
0

Well, Masking redirection is strictly prohibited in SEO. Better apply 301 redirection (permanent) which is suggested by Google.

I mean, move all of your contents from your blog pages to your main site. Then apply a 301 redirection to all of your pages of blog.example.com to your main domain example.com. Thats it.

What you have to keep in mind that, your blog's content url and site url structure should be same.

3
  • "Masking redirection is strictly prohibited in SEO." - Are you thinking of "frames"?? "Masking" is perfectly acceptable SEO-wise if done correctly... you could, for instance, proxy the request (using mod_proxy on Apache) from /blog to a different server. However, whether the current host supports this is another matter.
    – MrWhite
    Commented Nov 30, 2016 at 22:39
  • I cannot just move all the content from the subdomain to the main site because the main site does not support PHP and the subdomain uses PHP.
    – WilliamKF
    Commented Dec 1, 2016 at 17:34
  • @w3dk Your comment is verging on an answer, why not post it as an answer and elaborate a bit?
    – WilliamKF
    Commented Dec 1, 2016 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.