douben8492 2014-12-16 14:17
浏览 24
已采纳

从子域到root:最好的方法? [关闭]

I am not asking for a technical solution, just a plain "what approach would you recommend" vis-a-vis SEO, crawlability and user experience.

Imagine I am selling pastry on my website (let's call it pastry.com). I would like people specifically searching for cakes on google to go to my subdomain "cake.pastry.com" (listed as such on Google).

But, since I don't want to maintain multiple subdomains, "cake.pastry.com" would actually redirect to "pastry.com#cake", so that this approach could also be used for cupcakes and muffins! "cupcake.pastry.com" redirects to "pastry.com#cupcake", etc.

What would be the best way to do this? Is it possible to keep "cake.pastry.com" in the address bar while users are actually redirected "pastry.com#cake"? Would this pose a UX problem? Also, will this subdomain bring any value? I.e., will people searching for cakes on google actually find the "cake.pastry.com" subdomain higher than the root domain (because of keyword density, specificity of content...)? Would I need a 301 or 302 redirect? Via PHP or .htaccess?

So please, any opinion is welcome! Thank you!

  • 写回答

1条回答 默认 最新

  • dousongqiang2585 2014-12-16 14:44
    关注

    I cannot fully answer the SEO parts of this question. But as far as I know, it is no good idea to list a page with different domains at Google. Beside this, subdomains are not made for this purpose. At least I like addresses like http://pastry.com/cake much more than your examples.

    The technical answer:

    1. You need an wildcard DNS record to map all subdomains to pastry.com
    2. You can rewrite with mod_rewrite

    I've not tested this, but this is more an example to show how this might work:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.pastry\.com$
    RewriteCond %{HTTP_HOST} !^pastry\.com$
    RewriteCond %{HTTP_HOST} ([^\.]+)\.pastry\.com  [NC]
    RewriteRule ^(.*)$ http://pastry.com/#%1 [NE,R=301,L]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!