I have a Wordpress website. I have changed my permalinks several times. All past versions of the permalinks I used are still working. If I type them into the URL bar, I a
As you can see, Wordpress doesn't handle redirections when you change your permalinks structure. There is 2 ways to handle this, through:
.com/lightbulb
is the new path and .com/shop/lightbul
the old one:Options -Indexes
Options -Multiviews
Options +FollowSymLinks
RewriteEngine on
RedirectMatch 301 /shop/lightbulb(.*) /lightbulb$1
# or
# RewriteRule ^shop/lightbulb?(.*) http://www.domain.com/lightbulb$1 [R=301,L]
But if you want to redirect old permalink structure .com/shop/
to main domain your .htaccess
rules will be:
Options -Indexes
Options -Multiviews
Options +FollowSymLinks
RewriteEngine on
RedirectMatch 301 /shop/(.*) /$1
# or
# RewriteRule ^shop/?(.*) http://www.domain.com/$1
Permanent redirection is used for best SEO practices, redirecting definitively old permalinks to new ones, avoiding duplicate content, and telling search engines that your old permalinks have been moved definitively to new ones.
Converting old path (urls) in database (if they still exist):
You can use Search and Replace free plugin, to easily find some old related urls or path in your database and bulk replace them by the new ones. This is a very powerful plugin, a little buggy, but working fine when you know it (but make always a backup before).
A recent reference:
A Simple Guide to Changing Your Permalinks Without Breaking Your WordPress Website