-1

Possible Duplicate:
Apache redirect to another domain all URLs, except for ones starting with substring

I would like to optimize image loading for my website using multiple subdomains for the static files residing in /files. Is there a good way to achieve this? I wouldn't want multiple copies of my files on the disk. Also I am looking for a simple solution that doesn't involve having to install proxies and stuff.

I got my answer here: Apache redirect to another domain all URLs, except for ones starting with substring

Thank you all for your help.

bogdan
  • 155
  • 1
  • 8

1 Answers1

0

You should just be able to create other name-based virtual domains that point at the same document root, and set up the new names in DNS, and you can use these other names to your heart's content. If your current domain is not set up for name-based virtual domains, you will probably need to enable that before you can do this. If you are using IP-based virtual domains, then you shouldn't need any change at all. The virtual domains only really applies if you are hosting multiple sites each with different content.

If you really want to go wild you could set up a wild-card DNS record, and configure this domain to be the "default" name-based virtual so you could just use any random name, without having to change the server config, but I'd recommend against that. It's likely to lead to more pain than gain.

Sean Reifschneider
  • 10,720
  • 3
  • 25
  • 28
  • Thanks for your answer. I've already done that, but now all my URLs are duplicated, I would only like to duplicate the ones starting with /files. All the others should redirect to the main domain. The answer here http://serverfault.com/questions/314840/apache-redirect-to-another-domain-all-urls-except-for-ones-starting-with-substri helped me, but I think I should add another condition to prevent infinite redirection for the main domain. – bogdan Sep 26 '11 at 07:55
  • You'll want to set up a second Virtual host for those, then, and have a set of rewrite rules that redirect to the main host for anything other than /files/, should work just fine. – Sean Reifschneider Sep 28 '11 at 03:45