PDA

View Full Version : yet another subdomin question


jag7720
5th March 2008, 19:26
My site is www.mysite.com and I need the DocumentRoot to be /var/www/web1/web/catalog

Then I need to have a subdomain acc.mysite.com with a DocumentRoot of /var/www/web1/web


How can I accomplish this without a manual edit of the apache conf?


Thanks

edge
5th March 2008, 19:39
You could use a .htaccess file for this.
Something line this should work.
RewriteEngine on
RewriteBase /


RewriteCond %{HTTP_HOST} www\.mysite\.com
RewriteRule (.*) http://www\.mysite\.com/catalog/index.html$1 [R=301,L]

RewriteCond %{HTTP_HOST} acc\.mysite\.com
RewriteRule (.*) http://acc\.mysite\.com/web/index.html$1 [R=301,L]

jag7720
6th March 2008, 07:13
How do I get that to work with the the following already in the virtualhost config

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/oscatalog/.*$
RewriteCond %{REQUEST_URI} !^/oslanguages/.*$
RewriteCond %{REQUEST_URI} !^/osimages/.*$
RewriteCond %{REQUEST_URI} !^/uploads/.*$
RewriteCond %{REQUEST_URI} !^/fileopen\.php$
RewriteRule ^/(.*)$ /oscatalog/$1 [NC,L]
</IfModule>