Can files such as PDFs be uploaded to custom URLs? I would like to upload a PDF to
www.example.com/whitepapers/pdf.pdf instead of
I found a plugin called WP Easy Uploader which seems OK, but I wanted to check if there are any other solutions.
One solution I was contemplating is to have the PDF treated as a page so I can assign a parent page to the PDF. This will handle any redirects in case the URL of the parent page is changed.
UPDATE – Not Considering WP Easy Uploader any more since I don’t want to have any FTP access from within a WordPress installation for security reasons.
Attachments in general (images, but also files like PDFs) have a special “attachment page” of the form
example.com/main-post/attachment/file-title/. In most themes this is used to display a larger version of the image, still in the theme layout (so it returns a HTML file with the image in it, not the image directly).
You could exploit this by creating a template file that does serve the file directly, instead of just displaying it. Then if you create a page
example.com/whitepapers/ with an attachment called
file.php, the URL of the file will be
You would need to create a file in your theme directory called either
attachment.php (if you want to do this for all attachments) or
application.php (if you only want to do this for files with a mime type like
application/*). In that file you get the attachment file location and then
readfile() it to the browser. I guess there are already plugins out there that can do this for you.
UPDATE: Found Media Library Categories which sorts media by custom categories. All I need now is for a similar plugin to add that category to the URL so I can perform URL rewrites and get what I need!
Found a couple of plugins.
Relocate Upload allows you to upload to any folder and then have a drop down list when uploading media to place that new media in your custom locations. It looks ok but the files are placed in actual physical folders. It would be better if it could upload anything in one content folder and the ‘folder’ used in the link would be just a permalink. Also it did not work well on a quick localhost installation. It kept trying to access C:\wamp\www… instead of http://localhost/
Custom Upload Dir allows you to upload in custom directories but this did not meet my requirements.
About WP Easy Upload – I do not want to use it since I don’t want to give FTP access to any plugin inside the installation for security reasons.
Solution #1 You can change your Media Path. Go to Settings->Media
Change default “wp-content/uploads” to “whitepapers” of course if you upload other than whitepapers, this solution won’t work so well.
Solution #2 Use Pretty Link to customize your path
I have been using Pretty Links since I’ve been using WordPress; a few years now.
Mostly to simplify paths to files.
You can map “abc.com/whitepaper/file.pdf” into “abc.com/wp-content/uploads/file.pdf”