Im trying to create a subdomain and the main domain is a wordpress site!
Whenever i try to configure as shown in digitalocean tutorials and same in all other tutorials to create a subdomain, my subdomain shows me the content of my main domain.
Eg: my main domain is “https://example.com” and i want to create “https://forum.example.com” but it shows me my root site
I edit the vhosts as per the tutorials but still no luck, take a look vhost file:
<VirtualHost *:80> ServerAdmin info@example.com ServerName hi.example.com DocumentRoot /var/www/hi.example.com/public_html
<Directory /var/www/hi.example.com/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Please someone help me, im trying this from weeks! Appreciate your help!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
The Vhost looks correct. What you might be missing is:
/var/www/hi.example.com/
folder are setup correctly so that the Apache user has read and write access to the files.htaccess
file and make sure that there are no redirects thereNote: of course before running the search and replace make sure to backup your database in case anything goes wrong!
Hope that this helps! Bobby