问题原文
原帖链接 · WilliamKF · CC BY-SA 3.0
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.
已采纳解答
原帖链接 · MrWhite · CC BY-SA 3.0
...create
example.com/blogas 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.comintoblog.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.txtfile forblog.example.comto 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:
- Proxy all the requests from
example.com/blog/toblog.example.com/. - Change all your internal links to your new blog URL.
- Setup external (301) redirects from the old to new URLs. ie.
blog.example.com/toexample.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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
