My company hosts about 30 web sites all sharing the same code base and reusing many of the same images. Right now, the images for all of the sites are hosted on the one domain, and then every other site has to link to those images.
i.e., www.example.com/images/hello.jpg
and on www.example2.com we have something like:
<img src="http://www.example.com/images/hello.jpg" />
Recently someone told me that I should be putting all of these shared/static images on a subdomain, but I don't see the advantages to this. I have heard that there might be a slight speed increase, but I've also heard that it can complicate things. Can someone elaborate?
Because subdomains are regarded as separate websites by Google, they also need to be hosted on separate hosting plans. This means that you will need to pay a separate hosting fee for each subdomain.
A subdomain is an additional part to your main domain name. Subdomains are created to organize and navigate to different sections of your website. You can create multiple subdomains or child domains on your main domain.
To create a subdomain, log in to your cPanel or other control panel that your host provides and enter the Subdomains section. Under Create a Subdomain, enter the name of your subdomain. You can choose any name that makes sense. For example, you can use img, images, media or anything of your choice.
These are just a few common examples, but you can use a subdomain for virtually any structure you want to introduce to your website. You could theoretically host every page on your website on a different subdomain, like contact.example.com for your contact page, about.example.com for your about page, etc.
A couple advantages to it:
Downsides:
When a browser is requesting static files like CSS and Javascript, it often limits the number of connections to a given server/sub-domain. Putting static files under a different domain allows more simultaneous downloads.
If set up correctly, the different sub-domain may just be a directory on your webserver. Depends on your config-file-fu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With