Hello, I'm new to this forums, and I thought it would be a good place to ask. I have recently bought a domain, I've also added some subdomains to it. Now, my main website: mywebsite.com shows me my apache webserver. I've also set up the domain (forum.mywebsite.com) but it also leads to the main page of my apache webserver. I was looking around and found out it had to be in a config file (conf/extra/httpd-vhosts.conf) But how do I exactly set the forum.mywebsite.com to display the mywebsite.com/forum folder? Help is greatly appreciated.
you need to set the document root for the sub-domain to a folder <VirtualHost *> ServerName subdomain.domain.com DocumentRoot /home/httpd/htdocs/subdomain/ </VirtualHost>
Well, my config file is located here: "C:\xampp\apache\conf\extra\httpd-vhosts.conf" and my forum folder is located here: "C:\xampp\htdocs\forum" How would I then need to use the code? <VirtualHost *> ServerName forum.mydomain.com DocumentRoot ../htdocs/forum/ </VirtualHost> makes my whole website go to the forum folder.
Make sure you have both entries for your subdomain and regular domain in the conf file as <VirtualHost xxx.xxx.xxx.xxx> ServerName *.yourdomain.com ServerAlias yourdomain.com DocumentRoot /home/rootdir #Directory where Scritpting files are located. ErrorLog logs/error_log #Error are recorded in error_log file located /var/logs/httpd CustomLog logs/visit_log combined # URL visit information recorded in visit_log file located /var/logs/httpd </VirtualHost> <VirtualHost xxx.xxx.xxx.xxx> ServerName subdomain.youydomain.com ServerAlias subdomain.youydomain.com DocumentRoot /home/rootdir/subdomain ErrorLog logs/error_log CustomLog logs/visit_log </VirtualHost>
The problem is your domain A record. Please check with your resolving domain A record and apache configuration.