php - How to automatically route images, javascript, css to subdomain? -
So this is a deal,
I am currently building a site and planning for it Regarding recent talks about keeping images, javascript, and CSS (all still) files on a separate subdomain, in terms of performance and in such a way, in the case of performance, and in such a display move Reading so that the client will get the experience of downloading fast, when they go to the site
I understand why this works and is not looking for explanation about it, but when the site leaves my local god, then I will automatically refer to these subdomains for my How do I know about setting up a site? environment?
Images can be found here in the local / dev site:
http: //localhost/mysitename/assets/css/images/img1.gif
Production site:
http://www.mysitename.com/assets/css/images/img1.gif
I would say the following points to my production (not just production, local / dev environment):
http://images.mysitename.com/img1. GIF
I wonder how this is some automated way to do it? All the static files found on the site manually without making this change. (Maybe HTACE but not sure how)
Thank you.
A continuous one you use:
define ( 'IMAGE_PATH', 'http://www.mysitename.com/assets/css/images/');
Then use this when printing paths:
& lt; Img src = "& lt ;? php echo IMAGE_PATH ;? & gt; img1.gif" />
All you need to do is keep in mind. When you're ready to swap, just change the definition of IMAGE_PATH continuous.
Comments
Post a Comment