If you are a blogger and using WordPress as a blogging platform then you might be know that WordPress have an ugly & long URL for image and other uploads eg. http://www.example.com/wp-content/uploads/xxxxxx.xxx Which looks odd and if you are a frequent visitor of our blogs then you might know that we are using small URL’s (sub-domain) for images and other attachments like img.tech2how.com
Note : Now in WordPress 3.5 update the media upload option is disable. So you required additional plugin named “WP Original Media Path” to change media options.
What are the benefits of changing URL?
- Mostly they are short in length so they are easy to remember,
- Easy for sharing,
- Your WordPress directory size remains small so easy for backups.
- They are also a SEO optimized
- Looks cool in address bar 😉
How to do this?
- Go to your hosting dashboard or cPanel’s domain management then navigate to sub-domain option and create the subdomain of your blog’s domain for e.g. if your domain name is example.com then you can create img.example.com or images.example.com.
- In that options you can also select your subdomain directory to inside your default WordPress directory or outside of that( as suitable for you) or as you can backup easily. Also copy the full path of that directory we will need that later.
- Go to your WordPress Dashboard > Settings > Media option
- Scroll down to uploading files section in “Store uploads in this folder” paste the full path of your subdomain’s directory (which we copied in step no. 2) and add your subdomain name in “Full URL path to files”. Both are without trailing slash, as shown in screenshot.
- And also unchecked the option “Organize my uploads into month- and year-based folders.”
- Now you almost done just upload any image for verify your settings.
Bonus Tip : If you navigate to img.yourdomain.com then you might notice that anyone can see your all images and attachments. This is common server problem. To avoid this problem just create or add any index.php or index.html file to directory, or click here to add sample php file. Just download, extract and upload this file using cPanel’s file manager or any ftp client.
If you need any help or got the any error then please comment below. And if you find this blog post helpful then please do share with your friends.