View Full Version : sub-domains and .htaccess

11-12-2005, 12:59 PM

Due to an astounding amount of traffic (which I still don't believe we are creating - 450 gig a month from .js/.css/.html!?!), I have had to ".htaccess redirect" a lot of our inline graphics (as well as mov/mp3/wallpaper/pictures) from our site onto a weak record label backup server (load balancing is not your friend).

Problem. The htaccess redirects don't work at all for the sub-domains. All the layouts are screwy, because the images are not loading.

Aside from /var/www/html/subdomain, is there another way (preferably easy) to set up my ultiple subdomains so that they work?


11-12-2005, 06:14 PM
You can put your 'redirect' directives inbetween the respective <VirtualHost> directives in your httpd.conf file. You can find it here: /etc/httpd/conf.

Before doing that you should make absolutely sure you're using the directive properly. Review Apache's document on mod_alias (http://httpd.apache.org/docs/1.3/mod/mod_alias.html).

12-18-2005, 10:05 PM

Can you please elaborate on how .htaccess can be accomplished with subdomains?


12-19-2005, 01:34 AM
Hi asuant,

If the subdomain is pointing to a directory outside of the default pub root (/var/www/html), as you indicated in another thread, you'll need to set the AllowOverride directive for that directory.

Adding something similar to the following (preferably within the appropriate VirtualHost directive) to your httpd.conf might work.

<Directory "/path/to/your/subdomain/directory">
AllowOverride all

I suggest you do some reading before you start tinkering with your httpd.conf file, though. Definitely make a backup first!
Apache's htaccess information (http://httpd.apache.org/docs/1.3/howto/htaccess.html)
Apache's AllowOverride info (http://httpd.apache.org/docs/1.3/mod/core.html#allowoverride)
The Directory directive (http://httpd.apache.org/docs/1.3/mod/core.html#directory)