htaccess:301在目录中重定向所有内容

时间:2013-11-05 19:43:42

标签: regex apache .htaccess mod-rewrite google-webmaster-tools

在我以前的申请中,我有一堆个人资料位于:http://www.example.com/profile/12312534

但是我的新应用程序不再具有这些配置文件。是否有301 Redirect规则可以处理每个看似http://www.example.com/profile/*的请求?

网站管理员工具目前向我展示了数百种我想补救的404。

2 个答案:

答案 0 :(得分:1)

尝试此规则:

RewriteEngine On

RewriteRule ^profile/.*$ / [L,R=301,NC]

这会将每个/profile/*请求重定向到您的主路径/,R = 301(永久重定向),从而处理您的SEO排名。

参考:Apache mod_rewrite Introduction

更新:使用RedirectMatch

RedirectMatch 301 ^/profile/ /

答案 1 :(得分:0)

使用mod_alias:

RedirectMatch 301 ^/profile/ /
相关问题