I had a custom post type with slug as (sometext) which I changed to (someothertext)
And it works great
So for example :
my posts with urls like
http://localhost/sometext/innerposts
gets redirected to
http://localhost/someothertext/innerposts
but not my archive page
basically I would like to redirect
http://localhost/sometext/ to
http://localhost/someothertext/
in my .htaccess file
I tried adding a string to make it work
RewriteRule ^/sometext$ ^/someothertext/$ [R=301,L]
but it fails.
I’m very poor with .htaccess rewrites. I’ll really appreciate if someone helps me out with this.
Thanks.
The link to the archive page is saved into WordPress rewrite rules. These rules are used to locate several locations on the front end of your WordPress system. When you change the
slug
of a Custom Post Type, the normal pages will redirect directly to the new location, but the archive page won’t, this because the rewrite rules aren’t regenerated.To solve this, go to Settings -> Permalinks and save your permalink structure again, reload your page and the archive page will load correctly.
The rewrite rule in your
.htaccess
won’t be needed.Also, never put any rewrite rules in your
.htaccess
except the ones WordPress writes into it.If you want to add some rules, do this by using the Rewrite API.
As it was mentioned. Never put any rewrite rules in your .htaccess, use Rewrite API instead. To reach your goal, use following code in your functions.php or site-specific plugin: