Welcome to WebmasterWorld Guest from 54.166.141.12

Forum Moderators: rogerd & travelin cat

htaccess redirect for permalinks

     
6:52 pm on Mar 31, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Aug 30, 2007
posts:660
votes: 3


Can anyone advise the correct code to add to htaccess if changing the permalink structure? thanks in advance.
Wordpress installation is in the root not in a folder.

OLD/CURRENT (Custom) PERMALINK (with 'Category base as 'shows')
/news/%post_id%/%postname%/

NEW (Custom) PERMALINK (with no Category base)
/%category%/%postname%/
12:09 am on Apr 12, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

joined:Sept 14, 2011
posts:1045
votes: 132


I think because each post has the post id and the category has changed as well your going to need to set up individual redirects for each post. I wouldn't use .htaccess I would use a Redirect plugin for wordpress that accepts csv files like this one [en-gb.wordpress.org...]

Here what I would do:
1. download the sitemap of all the urls posts in existing format. Add it to column one of your csv file
2. in column 2 map the new url for each post in the csv file
3. upload - job done
3:21 am on Apr 12, 2018 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11356
votes: 147


if you don't want to rely on a plugin for this, you could easily add an internal rewrite so that all requests for the /news/... paths are sent to a script that handles the redirect responses using the same csv file described by seoskunk.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members