specific htaccess rewrites for WordPress categories

I am currently migrating my website form Joomla to WordPress. For each article and category I have created the required 301 redirects. So far I have over 200. However I am running into troubles with the categories.

I guess what I need is someway to make this line: redirect 301 /tips /category/tips/ really only target that url, and not random strings that follow it.

Read More

I will try to explain:

The main issue here is that WordPress likes to put /category/ infront of category archives BUT at the same time it does not show that behavior for individual post.
Example:
Tips overview= url/category/tips
Tips first article = url/tips/article1

This has created an unforeseen complication in my rewrites

redirect 301 /tips/149-wifi-netwerk-verbeteren /tips/netwerk/wifi-netwerk-verbeteren/
redirect 301 /tips/146-f-lux-beter-slapen-door-het-beeldscherm-automatisch-minder-blauw-te-maken /tips/windows/f-lux-beter-slapen-door-het-beeldscherm-automatisch-minder-blauw-te-maken/

#categories
redirect 301 /tips /category/tips/
redirect 301 /tips/processor /category/tips/processor/ 

The article url that was already correctly rewritten now also gets parsed a second time and therefore becomes incorrect because the “/category” gets thrown in there. This should not happen because /category/ is only used on the overview page and not on individual posts.

Reversing the order of these code blocks is no solution because that will mess up all 200+ current 301 rewrites for the individual articles. So I really need a code is only triggered when the exact /tips/ url is called, and nothing else. So it should not touch /tips/article1 and not /tips/subcategory/article2, etc.

Any thoughts?

Related posts

1 comment

  1. Try RedirectMatch ^/tips$ /category/news

    Or you may use the following plugin:
    https://wordpress.org/plugins/redirection/

Comments are closed.