moeses
moeses

Reputation: 507

Whats wrong with my Redirect 301 Regex?

Google Search Console has some crawl errors and can't find these links:

home-third-blog-posts/page/10/
home-third-blog-posts/page/5/
home-third-blog-posts/page/7/
home-third-blog-posts/page/9/

And my Redirect rule in .htacces looks like this

Redirect 301 /\/home-third-blog-posts\/.*/s http://foo.com

My Regex-Tester says its correct but when i test the links the redirect doesn't work. What did i do wrong?

Upvotes: 2

Views: 39

Answers (1)

hjpotter92
hjpotter92

Reputation: 80639

If you look at the documentation for Redirect directive, you'll see that it does not accept regex/patterns. You should be using the RedirectMatch instead:

RedirectMatch 301 /home-third-blog-posts/.* http://foo.com

also, no need to escape the / characters.

Upvotes: 2

Related Questions