I need to 301 redirect around 6000 URLs. I have already prepared and tested all the URLsand its working fine. But I’m facing only one problem.
Old URL to new URL redirection is working fine, for example:
Redirect 301 /career/old-url.html /career/new-url/1/
Redirect 301 /career/old-url2.html /career/new-url/2/
But when I add redirect category page URL to new category page URL, for example:
Redirect 301 /career /category/career/
Redirect 301 /career/old-url.html /career/new-url/1/
Redirect 301 /career/old-url2.html /career/new-url/2/
Then it breaks all URLs by adding “Category” word to the URLs, for example:
Redirect 301 /career/old-url.html /career/new-url/1/
Redirects to:
Redirect 301 /career/old-url.html /category/career/new-url/1/
Thus breaking all the URLs: If I won’t redirect that 47 Joomla category page URLs to New WordPress Category URLs then rest of 6000 URLs redirection works just fine.
I have 6000 articles URLs and 47 categories. So if I won’t redirect 47 categories then it will create 47, 404 pages. So I have only one question. What is the perfect code to redirect all the URLs along with the categories?
.htaccess processes redirects in order, so you need to have the most specific redirect at the top and the most general at the bottom. Try this instead:
You can try the following plugin:
https://wordpress.org/plugins/remove-category-url/
It simply removes /category/ from url.