【发布时间】:2015-07-30 11:00:19
【问题描述】:
基本上,我想使用 .htaccess 文件将机器人从常规站点重定向到静态版本。
情况如下: 我网站中的 URL 采用以下格式:
http://example.com/?p=something
http://example.com/index.html?p=something
http://example.com/basic.php?p=something
我想使用 .htaccess 文件将爬取前 2 个 URL 之一的机器人重定向到第三个,方法是用 basic.php 替换 index.html 或添加它(如果它不存在)。根也应该变成 basic.php 而不是 index.html。
这是我当前的 .htaccess 文件,这是错误的,因为它仅在 URL 包含 index.html 时才有效
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (googlebot|InfoSeek|msnbot|bingbot|Slurp|DuckDuckBot) [NC]
RewriteRule ^index\.html$ /basic.php [L,R]
如果有好心人能帮我解决这个问题,将不胜感激。谢谢
【问题讨论】:
标签: .htaccess mod-rewrite redirect seo