Forum Moderators: phranque

Message Too Old, No Replies

Htaccess pros! Setting subdomain to load images from domain.com/images

Setting images1.domain.com to load images from domain.com/images

         

Farmeroak

7:38 pm on Dec 12, 2009 (gmt 0)

10+ Year Member



I was reading a number of articles regarding paralleling requests from multiple hostnames to increase website speed (http://www.websiteoptimization.com/speed/tweak/parallel) . However, all the sources I read do not tell me how to actually do this.

What do I need? I want images to load from BOTH domain.com/images AND images1.domain.com . For example

Code:

<img src="http://www.domain.com/images/monkey.jpg">

and

Code:

<img src="http://images1.domain.com/monkey.jpg">

will both display monkey.jpg .

The most logical thing for me was to set up a subdomain images1.domain.com, and set it to redirect to domain.com/images . Unfortunately, this does not work. Should this work? I have a fairly complex .htaccess file, but nothing should interfere with this.

Of all the .htaccess examples I've seen, I can't find one that would do what I want. This seems like a very simple problem and I hope someone who knows more about regular expressions and .htaccess can help.

Thanks!

g1smd

10:24 pm on Dec 12, 2009 (gmt 0)

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



Setting this as a redirect will slow things down because the browser will have to make two requests for every file. Your log files will contain two entries, and it'll make a mess of your analytics.

You instead need an internal rewrite, and that's something covered on a regular basis here. There's several threads in recent weeks with example code to get you started.

Let's see your code.