具有子域的 Google 果汁并使用重写规则移植应用程序
背景:我在 sub.domain.com 上有一个网络应用程序。我的主要网站位于domain.com。我的 sub.domain.com 页面充满了我想用来提高 domain.com 页面排名的关键字。但是,整个应用程序都是在 sub.domain.com 上编写的,并且由于 URL 的编写方式等原因,将其托管在 domain.com/subdirectory 上需要花费一些精力。
第一个问题:您是否期望迁移(从 sub.domain.com 到domain.com/subdirectory)以大幅提高domain.com 的页面排名(与现在相比)?我做了很多研究,对于谷歌是否将子域与主域链接起来意见不一。
下一个问题:如果我确实想进行迁移,那么在实际代码库中将很难做到(与其说是困难,不如说是乏味)。有人对我如何使用 mod_rewrite 做到这一点有一些建议吗?我知道必须有一个聪明的方法来做到这一点,但我什至无法开始制定解决方案。也许这意味着这不是一件好事,但我希望能够快速破解,而不是重写我所有的 URL。另外,我希望它能够很容易地逆转,如果我更改我的 URL,情况就不会是这样(开发正在进行中,所以它不像只是推出以前的版本那么简单)。
Background: I've got a web app on sub.domain.com. My primary website is on domain.com. My sub.domain.com pages are stuffed with keywords that I would like to use to get upped in pagerank on domain.com. however, the whole app has been written on sub.domain.com, and it'll be some effort to host it at domain.com/subdirectory, due to how URLs are written, etc.
First question: would you expect that migration (from sub.domain.com to domain.com/subdirectory) to substantially improve the pagerank of domain.com over how it is now? I've done a lot of research, and opinions are split on if google with link the subdomain with the main domain.
Next question: if I do want to do the migration, it'll be difficult to do in the actual codebase (more tedious than difficult). Does anybody have some advice for how I could do this with mod_rewrite? I know there has to be a clever way to do it, but I can't even start to sketch out a solution. Maybe this means it's not a good thing to do, but I was hoping for kind of a quick hack, rather than rewriting all my URLs. Plus, I would like it to be pretty easily reversible, which wouldn't be the case if I change my URLs (dev is ongoing, so it's not as simple as just rolling out a previous version).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Pagerank 不是域的属性,而是单个文档的属性。因此,更准确的说法是,从
sub.domain.com
迁移到domain.com/subdirectory
将提高domain.com/subdirectory 的网页排名
。如果您只关心domain.com
主页的排名,那么对其的影响主要取决于您的内部链接。例如,如果sub.domain.com
上的所有页面当前都有一个指向sub.domain.com
主页的“主页”导航链接,并且当您执行您的操作后,他们现在将引导至domain.com
的主页,然后这将有助于domain.com
主页的排名。另一方面,如果此“主页”导航链接转到domain.com/subdirectory
,那么这就是他们将贡献 PageRank 的内容。mod_rewrite 不会更改 HTML 中的出站链接,它会更改入站链接的解释方式。因此,它可以让您将其放入虚拟主机文件或
sub.domain.com
的.htaccess
中:RewriteEngine 开启
RedirectRule (.*) http://domain.com/subdirectory/$1 [R=301]
将来自
sub.domain.com
的任何请求批量重定向到它们需要去的地方。它不会帮助您在代码库中生成正确的新格式 URL。 (理论上,您可以保留所有链接的原样,并依靠 301 重定向来避免更改它们,但这确实很草率和浪费,会无缘无故地生成两个 HTTP 请求,而不是一个)。Pagerank isn't a property of domains, it's a property of individual documents. So it'd be more accurate to say that migration from
sub.domain.com
todomain.com/subdirectory
will improve the pagerank ofdomain.com/subdirectory
. If you're concerned solely about the ranking of thedomain.com
home page, the impact on that will mostly depend on your internal linking. For example, if all pages onsub.domain.com
currently have a "home" navigation link that leads to the home page ofsub.domain.com
, and when you do your move they'll now lead to the home page ofdomain.com
, then this will contribute to thedomain.com
home page's ranking. If this "home" navigation link went todomain.com/subdirectory
, on the other hand, then that's what they'll be contributing pagerank to.mod_rewrite doesn't change the outbound links in your HTML, it changes how inbound links are interpreted. So it would let you put this in the virtual host file or
.htaccess
forsub.domain.com
:RewriteEngine on
RedirectRule (.*) http://domain.com/subdirectory/$1 [R=301]
to mass redirect any requests coming in on
sub.domain.com
where they need to go. It won't help you produce correct new-form URLs in your codebase. (You could, in theory, leave all your links how they are and rely on the 301 redirect to keep you from having to change them, but this is really sloppy and wasteful, generating two HTTP requests instead of one for no good reason).