I recently moved a blog from one host to another and now have a problem with a permalink - rather than opening up a page, it now opens an attachment.

The blog is using WP 3.0.4, running on PHP 5 and IIS 7.0. The permalinks are set to use "/%postname%/" and the web.config is as suggested in the Codex. The blog was moved using the WP export and import tools.

Previously http://site/blog/map opened up a page called map, but it is now opening http://site/blog/?attachment_id=xx. Does anyone know how to change this behaviour?

Thanks, Jon.

  • whats your htaccess like?
    – Bainternet
    Feb 15, 2011 at 11:07
  • btw: you should update to 3.0.5
    – kaiser
    Feb 15, 2011 at 11:23

2 Answers 2


Attachments are stored with their filename (minus extension) as the post name. So if you uploaded an attachment that's called map.xyz, it would have the same name as your page.

So first, check your Media Library if you have a 'map' attachment. Secondly, check if your 'map' page still exists and still has the same slug.

When wordpress tries to resolve your request, it can't figure if your are referring to a post(/attachment) or a page.

I would imagine that wordpress also does some slug mingling in the process of importing an export to avoid duplication of post names. It may have imported the attachment first and the page after and mingled your page name into something else.

Try using /posts/%postname%/ for your permalinks, this will distinguish them from pages.

Also read: http://codex.wordpress.org/Using_Permalinks#Structure_Tags

  • Thanks wyrfel - I've fixed it by changing the name of the file in the Media Library. Not sure how it ever worked on the old host though - any idea why that didn't have the same problem? Feb 15, 2011 at 14:24

If your permalink structure is /%postname%/, WordPress should create verbose rewrite rules for the pages. This means the individual pages get their own rules, before any other rules for posts or attachments. It seems this has not happened - maybe because of the import? Can you check your current rules with my rewrite analyzer plugin? You should see all your pages at the top, then followed by rules for your posts. If this does not work, try disabling and then re-enabling pretty permalinks, this should re-generate the rules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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