I wan to change my premalinks to attachment pages from http://example.com/.../attachemnt/something to http://example.com/.../attachemnt/something/something.jpg

It should simply add filename but with nice url, I tried with add query arg() but this builds url query like ?name=something.jpg.

Is there solution to achieve this without hard coding anything to wordpress?

  • Why would you want to do that? Would it not be easier to reference the actual file? eg. wp-content/uploads/2010/12/yourfile.jpg if you want the file name and extension in the URL..
    – t31os
    Dec 20, 2010 at 10:40
  • 2
    While the question is technically interesting, won't displaying image-like URL for HTML page be confusing?
    – Rarst
    Jan 17, 2011 at 8:19

1 Answer 1


This doesn't require a Wordpress modification per se, but if you prefer to do it that way, here is a decent tutorial: http://shibashake.com/wordpress-theme/wordpress-page-redirect. Some people would, however, prefer to do this via the .htaccess file, here is a quick guide on how to do redirects that way: http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/#red1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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