All my webpage URLs are structured as https://example.com/post-name/ in my wordpress website. I’d like to include category in URLs using permalink so all URLs will be look like https://example.com/category/post-name/. This will be a big threat for my SEO.
Is there a way to bulk redirect all my https://example.com/post-name/ URLs to https://example.com/category/post-name/?
3
Answers
Your best bet is to use a bulk export tool that will give you the permalinks of all posts in a CSV. We use WP All Export and it works beautifully for this.
The below instructions help you easily create individual redirects for a large number of posts. We’ve mapped thousands of posts for a move within minutes using this technique.
Step 1: Export all posts
You should end up with a CSV that has all the permalinks in this format…
Step 2: Add destination column
Duplicate the permalink column and add the category slug (easiest way to prepend is with something like Notepad++)
You will end up with column B like
*NOTE:*If you are adding in several categories like /catone/ /cattwo/ then you’ll want to make sure your export had another column that included the specific primary category of a post and add that in to the below concatenation.
Step 3: Concatenate the two columns into a single column
You will take the result and add to your .htaccess file.
The spreadsheet equation will look something like:
And the result will be:
Step 4: Launch new scheme
Place the redirects you generated into your .htaccess file but do not save.
Go to Settings>>Permalinks and change your permalink scheme to include the category.
Save permalinks and save the new .htaccess file.
Flush any caches.
Do some tests to make sure the redirects are working right.
Done!
I understand your question that you want to redirect URL of your post. The plugin that will help you in doing that is called Redirection. It is so easy to use and allow to add Bulk URL Redirections.
I was adding about 3 dozen redirects to a new website I recently built, I wasted a ton of time trying to do it one by one, when I got half way through I realized that there are multiple plugins that allow you to do this in bulk. All you’ve got to do is search redirect in your wordpress plugin section. Super simple and it will save you alot of tediousness and stress. Good Luck!