【问题标题】:error handling and search engines错误处理和搜索引擎
【发布时间】:2011-10-04 21:07:50
【问题描述】:

我刚刚更改了我的页面结构

例如

/my_page.php

/my_page/

但现在搜索引擎上的所有缓存页面都给出 404..

我该如何处理它们?是否可以将所有 404 重定向到域 www.domain.com 并同时将 301 重定向发送回搜索引擎?

【问题讨论】:

  • mod_rewrite 是满足您所有 URL 重写需求的通用解决方案。您最好的选择是将/my_page.php 重写为/my_page/(这应该很容易做到,因为它只需将.php 替换为/)

标签: apache error-handling seo


【解决方案1】:

在 htaccess(如果可用)或虚拟主机的配置中尝试以下操作:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*\.php$ /$1/[R=301,L]

【讨论】:

    猜你喜欢
    • 2014-01-17
    • 1970-01-01
    • 2011-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多