My website is supposedly serving it’s webpages using example.com, I have set it in the .htaccess that all traffic from www.example.com will be redirected to domain.com only.
Today, I received emails from my site with the link containing mail.example.com and when I clicked those link, it served the same webpages as example.com would! What’s worst is that my pages got indexed by google using mail.example.com
What could be the possible problem? What’s the cause of all this? And how to solve this? I want my site to serve only pages on example.com and not anywhere else. I want mail.example.com to function only for mails and nothing else. Please help.
I’m using AlmaLinux and Virtualmin.
Here’s my .htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect requests to the non-www version
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} !/.well-known/?.*
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (.w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>
Header always unset X-Frame-Options