.htaccess - HTACCESS issue- domain vs subdomain -
i have got lots of ideas google , stackoverflow- none of looking for. here scenario-
i have bought hosting space provider. had provide domain name(let abc.com) primary domain of hosting space.
then have found have put contents rimary domain(abc.com) document root directly. no directory www/abc or www/abc.com.
then googled , found lots of .htaccess solution. picked following one-
rewriteengine on
rewritebase /
rewritecond %{http_host} abc.com
rewritecond %{request_uri} !^/abc.com/(.*) [nc]
rewriterule ^(.*)$ /abc.com/$1
i have paste above lines @ end of existing .htaccess file (default). working fine. have been using www/abc.com directory abc.com domain then.
recently have added subdomains (let xyz.abc.com) abc.com domain. behaving strange me. subdomains looking contents abc.com/subdomain (eg. abc.com/xyz.abc.com)
this time getting no solution on google (i may missed it).
someone me please- in bad shape.
edited: following lines in webroot .htaccess beginning. after have added additional lines mentioned above(3,4)
# -frontpage- indexignore .htaccess */.??* *~ *# */header* */readme* */_vti* <limit post> order deny,allow deny allow </limit> <limit put delete> order deny,allow deny </limit> authname abc.com authuserfile /home/abc/public_html/_vti_pvt/service.pwd authgroupfile /home/abc/public_html/_vti_pvt/service.grp\
edited again: there other domains(except main domain abc.com) in same hosting space. domains have working sub-domains. sub-domain of main domain not working explained above.
change
rewritecond %{http_host} abc.com
to
rewritecond %{http_host} ^abc.com$
now rules not match subdomains anymore.
update
# catch www.abc.com , abc.com (and wwwwwwwwwww.abc.com) rewritecond %{http_host} ^(w+\.)?abc\.com$
Comments
Post a Comment