在我的工作中,我们有各种网页,我的老板认为,这些网页的排名低于应有的排名,因为“mywebsite.org/category/”在搜索引擎中看起来与“mywebsite.org/category/”不同index.php"确实如此,即使它们显示的是同一个文件。我认为这种方式行不通,但他深信不疑。也许我错了。我有两个问题:
- 如何让它在所有子类别的地址栏中显示“index.php”?
- 这真的是 pagerank 的运作方式吗?
最佳答案
- 除了更改所有链接之外,更简单的解决方案是使用重写规则。确保它是永久重定向,否则 Google 将继续使用旧链接(没有 index.php)。如何执行此操作完全取决于您的 Web 服务器,但对于 Apache HTTPd,它看起来类似于下面给出的示例。
- 是的。或者我听说过。很少有人知道。但是Google mentions this guideline (如“保持一致”)。确保检查所有 Google's Webmaster guidelines .
重写规则的 Apache 配置:
# in the generic config LoadModule rewrite_module modules/mod_rewrite.so # in your virutal host RewriteEngine On # redirect everything that ends in a slash to the same, but with index.php added RewriteRule ^(.*)/$ $1/index.php [R=301,L] # or the other way around, as suggested # RewriteRule ^(.*)/index.php$ $1/ [R=301,L]
关于.htaccess - 获取 "mywebsite.org/"解析为 "mywebsite.org/index.php",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1308485/