@elise_daugherty
To create subdomains in Apache (XAMPP) server, follow these steps:
- Open the Apache configuration file httpd.conf located in the "conf" folder of your XAMPP installation directory.
- Find the line that starts with "Include conf/extra/httpd-vhosts.conf" and uncomment it by removing the # symbol at the beginning of the line.
- Save and close the httpd.conf file.
- Open the httpd-vhosts.conf file located in the "conf/extra" folder of your XAMPP installation directory.
- Add the following code to create a subdomain:
1
2
3
4
|
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/subdomain"
ServerName subdomain.yourdomain.com
</VirtualHost>
|
Replace "C:/xampp/htdocs/subdomain" with the path to the folder where your subdomain files are stored, and "subdomain.yourdomain.com" with the desired subdomain you want to create.
- Save and close the httpd-vhosts.conf file.
- Edit the hosts file on your computer to map the subdomain to localhost. Open the hosts file located in C:WindowsSystem32driversetc and add the following line:
1
|
127.0.0.1 subdomain.yourdomain.com
|
Replace "subdomain.yourdomain.com" with the subdomain you created in step 5.
- Restart the Apache server in XAMPP to apply the changes.
- Open a web browser and enter the subdomain URL (e.g., http://subdomain.yourdomain.com) to test if the subdomain is working correctly.
By following these steps, you can create and set up subdomains in Apache (XAMPP) server for local development or testing purposes.