For a new Wordpress website of mine I'm running into a little problem.
There is a custom post type named 'vehicle' which uses the url slug 'vehicle'.
The thing is, my website isn't aimed at cars, but at boats, so I want to change the url to www.domain.com/boats/boatname1 instead of www.domain.com/vehicle/boatname1.
I have succeeded in editing the slug using the following code - after which I flushed the rewrite url's and changed permalinks back and forth:
function change_vehicle_rewrite_rules() { global $wp_post_types; $rewrite = &$wp_post_types['vehicle']->rewrite; $rewrite['slug'] = 'horses'; } add_action( 'init', 'change_vehicle_rewrite_rules', 999 );
On my homepage, there are nog links showing www.domain.com/boats/boatname, but when I click on them, I get a 404. If I change the url to www.domain.com/vehicle/boatname it DOES work. So the url's have changed, but the working post is still shown under /vehicle/ instead of under /boats/.
Is there a way, perhaps using .htaccess, so that EVERY url on my website that shows /vehicle/ is changed to /boats/ ?
Or perhaps a way that when I click on a link www.domain.com/boats/boatname that it SHOWS the /vehicle/ content, but shows /boats/ in the URL.
Thanks in advance for your help!
Mike
How many different URL's are we talking here? If it's not a huge amount, you can look into one of the text replace plugins and specify each original URL, and what you want the text to be replaced with (ie: from "vehicle" to "boats")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.