Forum Moderators: phranque

Message Too Old, No Replies

quicker page downloads using subdomains

mod_rewrite possible?

         

jamie

6:26 am on Jan 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

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]

jdMorgan

1:51 pm on Jan 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't mod_rewrite anything anywhere... It's not capable of "moving" anything.

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]

jamie

6:15 pm on Jan 20, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



many thanks jim

that's a very clear explanation.

james