Quantcast
Channel: Crunchify
Viewing all articles
Browse latest Browse all 1037

How to redirect WordPress Category Pages to Another Category? Fix using Regex Pattern in .htaccess File

$
0
0

Recently in Google Search Console I’ve started seeing lots of HTTP 404 errors related to /services/ category.

I used to have different dedicated blog http://crunchify.com/services/.

Last month, I’ve decommed that site and moved to static page. If you visit URL http://crunchify.com/consulting-services/, it’s just a simple WordPress page.

As, http://crunchify.com/services was a dedicated blog, there were few categories and pages which are not accessible now. All of those blog pages might be cached in Google Sitemap or other Social Media and hence while crawling, those pages are resulting into 404 error page.

Usually, HTTP 404 errors doesn’t affect your page ranking in Google but it’s not a good behavior for users. Ideally, it’s good practice to visit Crawl error page once a month and fix all 404 errors which you could.

If you have any of below questions then you are at right place:

  • Category Redirection for WordPress (301 Redirects)
  • Redirecting one category to another using .htaccess
  • How to Change Category Slug within WordPress
  • How to 301 redirect old wordpress category?
  • How to Properly Rename Categories in WordPress

How to fix HTTP 404 error?

I was wondering, what is the best way to fix these 404 errors?

There are two ways:

  1. Add redirection for each 404 page
  2. Add regex pattern to match /services/ in URL and direct all pages to /consulting-services/ page

I choose to go for 2nd option.

What do I have to do?

In order to achieve point 2 above, you need to add below line to your .htaccess file.

RewriteRule ^services/?(.*)$ http://crunchify.com/consulting-services/ [R=301,L]

I waited a few days and all Google Search Console errors for /services/ URLs disappeared. I hope this helps you. Happy blogging.

Have a suggestion on article? Please chime in and share it as a comment.

The post How to redirect WordPress Category Pages to Another Category? Fix using Regex Pattern in .htaccess File appeared first on Crunchify.

Author: App Shah

Crunchify, LLC Logo


Viewing all articles
Browse latest Browse all 1037

Trending Articles