I have my main site: example.com
that contains all files on its root folder.
I have a new domain example.net
, that I want users to use as an alias domain, so users will actually see the exact content of example.com
and its files, yet see in their address bar the site example.net
.
But, I don't want Google to index example.net
site at all, as this would be duplicate content.
Therefore, I want to exclude it using robots.txt
, but if I use an alias domain, it will try to read robots.txt
of example.com
.
What can be the solution? any way to exclude the file?
You can use:
RewriteEngine on
RewriteCond %{HTTP_HOST} example\.net$ [NC]
RewriteRule ^robots\.txt$ robots-net.txt [NC,L]
Add your robot rules in the file robots-net.txt
to be read with robots.txt
but only when accessed from example.net
.