Forum Moderators: phranque

Message Too Old, No Replies

Wordpress redirect rules

What are the proper redirect rules when using permalink plugin in wordpress

         

PrattTA1

8:02 pm on Jan 5, 2008 (gmt 0)

10+ Year Member



I just installed the permalink plugin on my wordpress blog, but am having trouble coming up with the redirect rules in my .htaccess file to redirect my old blog post.

I need to redirect a post like: www.my-blog.com/?p=13 to www.my-blog.com/post-name

What rules do you need to do this? Thanks for your help!

g1smd

12:26 am on Jan 6, 2008 (gmt 0)

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



Are you sure that you want the posts to be indexed under www.domain.com/post-name URLs?

You can't do this with a simple .htaccess rule. You'll need to modify the wordpress script to examine the requested parameter-based URL, look up the post-name in the posts database, and then issue a 301 redirect to the new URL.

There is a major problem looming should you ever use the exact same post name on another post at some point in the future.

There is nothing wrong with indexing of URLs with one parameter in them. I would have stuck with doing that.

lammert

1:10 am on Jan 7, 2008 (gmt 0)

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



There is a major problem looming should you ever use the exact same post name on another post at some point in the future.

My experience with WordPress is that it automatically detects possible duplicate post names and it will automatically add a sequence number to the URL when necessary. I.e. "a-post-name" becomes "a-post-name-2", the second time the title "A post name" is assigned to a post.

g1smd

11:31 pm on Jan 7, 2008 (gmt 0)

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



That has to be scripted somewhere, so if you think it might do that, test it and make sure that it really does do that.

agentvic

5:41 am on Jan 8, 2008 (gmt 0)

10+ Year Member



You'll have to know the correct urls and do something like this in your .htaccess for each post you need redirected.

Redirect 301 /?p=13 http://www.example.com/post-name
Redirect 301 /?p=14 http://www.example.com/post-name
Redirect 301 /?p=15 http://www.example.com/post-name

and so on

[edited by: jdMorgan at 6:13 am (utc) on Jan. 8, 2008]
[edit reason] example.com [/edit]

Marcia

5:48 am on Jan 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There should be something right in the interface for customizing permalink URLs (especially for WP2.3 which is much improved), and also check out some of the SEO plug-ins.

g1smd

12:10 pm on Jan 8, 2008 (gmt 0)

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



@agentvic: You can't do this with a simple .htaccess rule. You'll need to modify the wordpress script to examine the requested parameter-based URL, look up the post-name in the posts database, and then issue a 301 redirect to the new URL.

PrattTA1

3:56 pm on Jan 9, 2008 (gmt 0)

10+ Year Member



Thanks for the help everyone, I really appreciate it.