[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] HELP! .htaccess won't run on rewritten subdomain



I've been having some vast problems with my Raq4 in reguards to mod_rewrite 
and .htaccess.

I've setup the following in virtualhost to direct any incomming subdomain for 
my domain to a respective folder.

i.e. blah.domain.com or www.blah.domain.com goes 
to /home/sites/site4/sites/blah/

I have been able to get CGI to work on the re-written domains by allowing cgi-
script however I cannot get it to process .htaccess files for rewritten 
(mod_rewrite) subdomains (shown in httpd.conf below this message).

When I access a .htaccess protected directory which has been rewritten I get 
an error comming up (Cannot find server or DNS Error) in Internet Explorer.

If I remove .htaccess it allows access (but I need .htaccess in this folder 
as password protection). htaccess files work on domain.com but not on any re-
written subdomains.

I have tried everything within my newbie knowledge of apache and gotten 
nowhere, I've added the following to access.conf to no avail.

<Directory /home/sites/site4/sites/*>
AllowOverride All
Options All
</Direcrory>

Does anyone have any Ideas what I can do to get these .htaccess files to be 
processed under a rewritten domain as I am really stuck.

James Austin.

The method for this is shown below using httpd.conf
(I've removed all the domain & IP bits)
========================================

<VirtualHost 2xx.xxx.xxx.xxx>
ServerName www.domain.com
ServerAdmin admin
DocumentRoot /home/sites/site4/web
ServerAlias domain.com *.domain.com

RewriteEngine on
RewriteMap	lowercase	int:tolower
RewriteCond ${lowercase:%{HTTP_HOST}}	(www\.|)[^.]+\.domain\.com$
RewriteCond ${lowercase:%{HTTP_HOST}}	!^domain.com?$
RewriteCond ${lowercase:%{HTTP_HOST}}	!^www.domain.com?$
RewriteRule ^(.+)	${lowercase:%{HTTP_HOST}}$1	[C]
RewriteRule ^(www\.|)([^.]+)\.domain\.com(.*)	/home/sites/site4/sites/$2$3
RewriteOptions inherit

AliasMatch  ^/~([^/]+)(/(.*))? /home/sites/site4/users/$1/web/$3

AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php
# AddHandler chiliasp .asp
# AddHandler chiliasp .asa
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
AddHandler cgi-wrapper .cgi
AddHandler cgi-wrapper .pl
AddHandler server-parsed .shtml
AddType    text/html     .shtml
</VirtualHost>