Forum Moderators: phranque
i'd like to create a subdomain for images (img.example.com) in order to allow more parallel downloads of components of our pages.
would this still work if i mod_rewrite the images to this subdomain internally:
RewriteCond %{REQUEST_URI} (\.gif¦\.jpg¦\.css)$
RewriteRule ^(.*)$ http://img.example.com$1 [L]
or must the <img> tag actually point to the subdomain (src="http://img.example.com/myimage.gif") for the browsers to know that it is a subdomain?
many thanks
[edited by: jdMorgan at 1:51 pm (utc) on Jan. 18, 2008]
[edit reason] de-linked [/edit]
When doing an internal rewrite (as opposed to a redirect), mod_rewrite simply changes the server filepath used to serve a requested URL.
Therefore, you must change all of your <img src="xyz"> links to *define* a new URL, and then take steps (possibly using mod_rewrite) on your server to re-map requests for the image subdomain to the desired path in your account's filespace.
We have a lot of previous threads here about setting-up and using subdomains -- Try a site search, and read carefully before committing to this project (and changing all of your image links)! Some hosts make it easy, others don't... :(
Jim
[edited by: jdMorgan at 1:52 pm (utc) on Jan. 18, 2008]