Changed permalink from category/postname to /postname and Wordpress is not auto-redirecting?

Zakch93

Elite Member
Joined
Mar 7, 2020
Messages
2,307
Reaction score
855
Hi, I thought Wordpress could detect and auto-redirect permalinks URL changes in the latest version. It's not working for me.

Result, all my old category/postname links and backlinks are now unusable until I find a fix.

I tried "Redirection" plugin but don't know how exactly to use and if it can fix my problem. Appreciate any indications on this!
 
you can also redirect with .htaccess
but i don't recommend you to change URL if already indexed in google.
i already done this with my blog and got 404 error from search engine traffic.
 
It is simple to redirect in htaccess.
you can also redirect with .htaccess
but i don't recommend you to change URL if already indexed in google.
i already done this with my blog and got 404 error from search engine traffic.
How to do it guys I've been looking at guides but didn't find the info.

We're in 2021 and sending rockets to Mars and you're telling me Google doesn't have the technology to work out a simple permalink redirect? Lol no way José there has to be a fix for your thing. I will test search engine traffic afterward and report to you after I fix the issue.
 
Hi, I thought Wordpress could detect and auto-redirect permalinks URL changes in the latest version. It's not working for me.

Result, all my old category/postname links and backlinks are now unusable until I find a fix.

I tried "Redirection" plugin but don't know how exactly to use and if it can fix my problem. Appreciate any indications on this!
You need to redirect old urls to new ones.
Go to "redirection" plugin and enter /category/postname in the first field and /postname in the second field.
It's that easy... no matter if your posts are indexed... google will follow the redirects and will serve new urls.
 
You need to redirect old urls to new ones.
Go to "redirection" plugin and enter /category/postname in the first field and /postname in the second field.
It's that easy... no matter if your posts are indexed... google will follow the redirects and will serve new urls.
Yes but is there a way to do it in bulk? Post by post would take ages.
 
How to do it guys I've been looking at guides but didn't find the info.

We're in 2021 and sending rockets to Mars and you're telling me Google doesn't have the technology to work out a simple permalink redirect? Lol no way José there has to be a fix for your thing. I will test search engine traffic afterward and report to you after I fix the issue.
RewriteEngine On
RewriteRule ^category/(.*)$ /$1 [R=301,NC,L]

This will redirect all links containing "category" to the same URLs without "category".

If you have some other rules in htaccess below RewriteEngine On - it can matter where you place this rule.
 
RewriteEngine On
RewriteRule ^category/(.*)$ /$1 [R=301,NC,L]

This will redirect all links containing "category" to the same URLs without "category".

If you have some other rules in htaccess below RewriteEngine On - it can matter where you place this rule.
Thanks mate trying it right now. By the way old links were: /blog/categoryname/postname, so that's two categories, think that's why it didn't redirect automatically?

Edit: added it at the end of htaccess but it didn't give the effect. Yes I have other rules in htaccess below RewriteEngine On, where do I add this then?

Also found this code online:

Rewrite URLs with a query parameter to a directory-based structure while retaining query string parameters in the URL subdirectory​

Example: The original URL is http://www.website.com/index.php?category=fish and the new page being http://www.website.com/category/fish/

RewriteEngine On
RewriteRule ^/?category/([^/d]+)/?$ index.php?category=$1 [L,QSA]

Is the one you shared what I need and not this?

 
Last edited:
Thanks mate trying it right now. By the way old links were: /blog/categoryname/postname, so that's two categories, think that's why it didn't redirect automatically?

Edit: added it at the end of htaccess but it didn't give the effect. Yes I have other rules in htaccess below RewriteEngine On, where do I add this then?

Also found this code online:

Is the one you shared what I need and not this?

Edit rule according your category slug - /blog/categoryname/
 
Edit rule according your category slug - /blog/categoryname/
Like this?

RewriteRule ^blog/sports/(.*)$ /$1 [R=301,NC,L]

also where to add it if I have other rules in htaccess below RewriteEngine On?
 
You can remove or keep Category slug through Yoast WP plugin. Pretty easy if you use WP site.
 
Like this?

RewriteRule ^blog/sports/(.*)$ /$1 [R=301,NC,L]

also where to add it if I have other rules in htaccess below RewriteEngine On?
Yes, like this. If your have many categories like "sports" - google for universal part to add for it.

Depends that are doing your other rules. Try at the bottom.
 
Yes, like this. If your have many categories like "sports" - google for universal part to add for it.

Depends that are doing your other rules. Try at the bottom.
Nope. Pm'd you mate.
 
Ok I solved it with Redirection plugin beta function

Permalink Migration​

will need to check htaccess to see what it did. Thanks everyone
 
If you want to redirect, simply you need to redirect old url to new ones.
 
Back
Top