Redirecting Old Permalink Structure for Wordpress
4 posts
• Page 1 of 1
Redirecting Old Permalink Structure for Wordpress
For starters, I love the new, clean forum look guys, great job.
I'm using Isapi Re-write 3 (full version) and want to know what code to install the htaccess for the following permalink structure:
http://www.domain.com/blog/%postname%-%post_id%/ (notice the hyphen and not a / between postname and id)
ex. http://www.domain.com/blog/deep-sea-fishing-1175/
My current permalink structure is http://www.domain.com/blog/%year%/%monthnum%/%postname%/
ex. http://www.domain.com/blog/2012/03/deep-sea-fishing/
In addition to adding the correct rules for the new permalink structure; Is there a line similar to RedirectMatch that will 301 redirect all of the old link structure to the new link structure?
I found a similar idea here: http://yoast.com/change-wordpress-permalink-structure/
But it uses the RedirectMatch rule that Isapi doesn't support. I'm not sure if I used the utility correctly but it gave me this:
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://www.domain.com/blog/$3
In Summary:
Htaccess Code for:
/%postname%-post_id%/
301 Redirect rule for:
/blog/%year%/%monthnum%/%postname%/ TO /%postname%-post_id%/
Thanks in advance!
I'm using Isapi Re-write 3 (full version) and want to know what code to install the htaccess for the following permalink structure:
http://www.domain.com/blog/%postname%-%post_id%/ (notice the hyphen and not a / between postname and id)
ex. http://www.domain.com/blog/deep-sea-fishing-1175/
My current permalink structure is http://www.domain.com/blog/%year%/%monthnum%/%postname%/
ex. http://www.domain.com/blog/2012/03/deep-sea-fishing/
In addition to adding the correct rules for the new permalink structure; Is there a line similar to RedirectMatch that will 301 redirect all of the old link structure to the new link structure?
I found a similar idea here: http://yoast.com/change-wordpress-permalink-structure/
But it uses the RedirectMatch rule that Isapi doesn't support. I'm not sure if I used the utility correctly but it gave me this:
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://www.domain.com/blog/$3
In Summary:
Htaccess Code for:
/%postname%-post_id%/
301 Redirect rule for:
/blog/%year%/%monthnum%/%postname%/ TO /%postname%-post_id%/
Thanks in advance!
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirecting Old Permalink Structure for Wordpress
Hello,
For a new URL structure try using the following:
Regarding your idea to convert /blog/%year%/%monthnum%/%postname%/ TO /%postname%-post_id%/ there's no way to get PostID form a URL that doesn't have it. You may simply leave the old set of rules for those links to make them work for users coming from other sites.
Regards
Andrew
For a new URL structure try using the following:
- Code: Select all
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(?:[^/-]+)-(\d+)/?$ index.php?p=$1 [NC,L]
Regarding your idea to convert /blog/%year%/%monthnum%/%postname%/ TO /%postname%-post_id%/ there's no way to get PostID form a URL that doesn't have it. You may simply leave the old set of rules for those links to make them work for users coming from other sites.
Regards
Andrew
- suntattood
- Posts: 27
- Joined: 04 Dec 2012, 21:06
Re: Redirecting Old Permalink Structure for Wordpress
This doesn't change with regards to the latest update, right?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirecting Old Permalink Structure for Wordpress
No, it doesnt.
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 19 guests