Suppose you are opening a website without www & it is showing different website content then issue is with your Virtual host entries. Recently I was configuring a virtual host for one of my website. After configuration I have noticed that without www first virtual host website is opening.
For example I have configured 2 virtual hosts on my server.
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example2.com
# Other directives here
</VirtualHost>
When I open example2.com without www it is showing content of example.com not example2.com
Solution for this issue is to defining ServerName & ServerAlias Properly. For example
ServerName example.com
ServerAlias *.example.com
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName example2.com
ServerAlias *.example.com
# Other directives here
</VirtualHost>
Comments
Let's collaborate
write to us
contact@ucodice.com
PHP
Laravel
Angular
React Native
Internet of Things (IOT)
Mobile App Development
Website/Software Development
Hire Dedicated Team/Developers