.htaccess - HTACCESS issue- domain vs subdomain -


i have got lots of ideas google , stackoverflow- none of looking for. here scenario-

  1. i have bought hosting space provider. had provide domain name(let abc.com) primary domain of hosting space.

  2. then have found have put contents rimary domain(abc.com) document root directly. no directory www/abc or www/abc.com.

  3. 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

  4. i have paste above lines @ end of existing .htaccess file (default). working fine. have been using www/abc.com directory abc.com domain then.

  5. 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)

  6. 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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -