Forum Moderators: phranque

Message Too Old, No Replies

Redirect image subdomain to main site to avoid duplicate url

rewrite, apache

         

thatsme

1:07 pm on Jan 6, 2010 (gmt 0)

10+ Year Member



I just setup a subdomain to serve images to my main site and I pointed subdomain to same folder same as my main site having.

Now the image subdomain (img.example.com) is serving images but when I open this url in browser it opens my main site (example.com) because both are pointed to same folder.

I am looking for a rewrite rule which can do a 301 redirect img.example.com to example.com but continue serving images from img.example.com/images

Help me!

jdMorgan

5:33 pm on Jan 6, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First you have to define 'images' in some way that can be understood by program code in your server. You and I both know what 'images' means, but computers are not so smart...

Looking at a requested URL, how can you most easily tell it's a request for an image? Are all images stored in a particular directory structure (such as a subdirectory called "/images")? Or is checking for one of several "file types" like .gif, .jpg, .jpe, .jpeg, .png, etc. the only way to tell?

It is simple to fix this problem. It is not quite so simple to fix it in an efficient manner. And because you have considered image-loading performance as important enough to actually go implement a separate subdomain, it's obvious that your traffic levels are high and that an efficient solution is needed.

Jim

thatsme

6:19 am on Jan 7, 2010 (gmt 0)

10+ Year Member



Then what should be that efficient solution as per your views? I simply want to Parallelize downloads across hostnames. Do this meam I need to use a different hostname or a subdomain on same host?

jdMorgan

7:16 am on Jan 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dunno.

First you have to define 'images' in some way that can be understood by program code in your server.

... and once you've defined it, you can tell us the definition, and then we can help with this problem.

Generally, if contributors here post questions in response to your question(s), then the discussion cannot productively continue until those questions are answered.

Jim