Question

In my previous application, I have a bunch of profiles located at: http://www.example.com/profile/12312534

But my new application no longer has those profiles. Is there a 301 Redirect rule that can take care of every request that looks like http://www.example.com/profile/*?

Webmaster Tools currently shows me thousands of 404s that I'd like to remedy.

Was it helpful?

Solution

Try this rule:

RewriteEngine On

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

This will redirect every /profile/* request to your home path / with R=301 (permanent redirect) thus taking care of your SEO ranking.

Reference: Apache mod_rewrite Introduction

UPDATE: Using RedirectMatch:

RedirectMatch 301 ^/profile/ /

OTHER TIPS

Using mod_alias:

RedirectMatch 301 ^/profile/ /
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top