Search code examples
apache.htaccesssubdomaincpanelwhm

Subdomain is redirecting to primary domain files


I have created a subdomain(development.domain.com.np). Everytime when i hit the subdomain url it shows subdomain link but uses primary domain index.php file. But when remove index.php file from my subdomain and replace it with index.html it works fine. I am not able to figure out what is causing this.
I have checked redirects and logs but everything seems fine.
Do I have to add anything in htaccess file?
. Any help is highly appreciated. Thank you.


Solution

  • You need to create 2 virtualhosts in your apache configuration pointing to 2 different documentRoots: one for each virtualhost. This way each virtualhost will handle just one domain: the documentRoot in each virtulahost will show only the files related to that specific domain.