Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have updated my permalink structure to /archive/%post_id%, but if someone uses a URL like /archive/456857 instead of the full URL of /blog-test, WordPress shows the post without giving a 301 to the full URL. Isn't this poor SEO? Sites like tumblr and stackexchange automatically send a 301 to the full URL. Any hacks/code/plugins/settings/etc to fix this?

/archive/456857 does get a 301 to /blog-test but /archive/456857 does not and ends up in two separate URLs to the same content.

My permalink structure is /archive/%post_id%.

share|improve this question
    

2 Answers 2

Some things in your post are still unclear, but if it's only the SEO you are worrying about, you can set a canonical tag in your header, referencing always the correct post_name url:

<?php if(is_singular()){
echo '<link rel="canonical" href="'.get_permalink().'" />';
} ?>

That way you're telling the search engines where the original post is.

share|improve this answer
    
How do all the things it redirects?! –  mbn Oct 23 '12 at 8:32
    
You don't really need to do the redirects if there's a canonical link. Search engines will only index the right URL's that way. It's still accessible, but it's not a problem anymore. –  Pieter Oct 23 '12 at 11:31

The question is, how many URLs of the structure,

/archive/%post_id%

...exist as either indexed pages within search engines or as external back links from other sites?

You see, just because you can access a URL from two different formats, ID or slug, doesn't mean your SEO would be effected necessarily.

If you have links in the SERPs or external to your site that now exist under a different URL structure you can use a plugin like, http://wordpress.org/extend/plugins/simple-301-redirects/ to help you with 301 redirects.

Although WordPress internal rewrite rules should handle this for you automatically when you have a custom permalink structure set.

You could go beyond this and create your own special rewrite rules, but lets not jump into regex and all that if we don't have to when the above plugin might be enough.

By the way this doesn't make sense,

p.s. /archive/456857 does get a 301 to /blog-test but /archive/456857 does not and ends up in two separate URLs to the same content.

share|improve this answer
    
How do all the things it redirects?! –  mbn Oct 23 '12 at 8:31
    
@mbn Sorry mate, can you please rephrase that comment - its a little unclear what is meant by that? If you read my answer, I have a question within it that if you could please answer would allow me to provide a better course of action for you to take. –  userabuser Oct 23 '12 at 8:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.