【问题标题】:mod_rewrite and SEO friendly with redirect 301mod_rewrite 和 SEO 对重定向 301 友好
【发布时间】:2012-04-09 08:09:16
【问题描述】:

我的 .htaccess 文件中有以下内容:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^$ /Home [R,NC] 
RewriteRule ^Home$ /index.php [NC,L]

但如果我访问 mydomain.com/index.php 仍然可以访问并显示与 mydomain.com/Home 相同的内容。这对我来说没问题,但对 SEO 来说并不好,因为我有重复的内容,所以当我访问 /index.php 时,有没有办法进行重定向并将 URL 重写到 /Home ? 我尝试使用

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^$ /Home [R,NC] 
RewriteRule ^Home$ /index.php [NC]
RewriteRule ^index.php$ /Home [R=301,L]

但它在循环中。

【问题讨论】:

    标签: .htaccess mod-rewrite


    【解决方案1】:

    如果确实是相同的内容,您应该选择canonical links,而不是摆弄 mod-rewrite/htaccess 的深层地牢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-07
      • 2013-01-06
      • 2012-05-22
      • 2012-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-15
      相关资源
      最近更新 更多