FTP domain indexed by google

228 Views Asked by At

We are facing a very strange issue where google is indexing our FTP domain ftp.example.com.

We do not have that as a subdomain and there is no root folder or any other files for it.

So I am not sure how to block it and make sure Google does not index it.

Things I have tried:

I have checked file manager and also tried to add robots and .htaccess file to redirect it main domain but it is not working.

Can anyone help me with it?

New information

We are using Control Web Portal (CWP) and not cpanel.

We added the following .htaccess rule to the root folder of main domain

RewriteEngine On
RewriteCond %{HTTP_HOST} ^ftp\.exrx\.net  [NC]
RewriteRule ^(.*) https://exrx.net/$1 [L]

But this is also not working

1

There are 1 best solutions below

2
MrWhite On

Many hosting control panels (like cPanel, Plesk, etc.) create several subdomains automatically, including ftp.example.com. This is simply an alias of the main domain (there is no subdirectory that it points to) that is created as a "convenience".

If Google has picked this up then there are likely "public" links to this subdomain somewhere.

In something like cPanel, you may not be able to remove it (without perhaps disabling the FTP service)or manually editing the DNS zone. However, you can redirect requests to your main domain to resolve the indexing issue.

For example, at the top of your root .htaccess file using mod_rewrite:

 RewriteEngine On

 # Redirect "ftp.example.com/<anything>" to "www.example.com/<anything>"
 RewriteCond %{HTTP_HOST} ^ftp\.example\.com [NC]
 RewriteRule ^ https://example.com%{REQUEST_URI} [R=301,L]

You must not try and block these requests using robots.txt as you will just end up blocking all requests and Google won't see your redirect!

It will take a while for Google to update its index.


UPDATE:

Assuming ftp.exrx.net is the actual hostname in question, then it would seem the DNS entry (CNAME or A record) for this subdomain has since been removed so the hostname no longer resolves. (The DNS entry must have been present initially, otherwise the hostname would not have been indexed.)

Consequently you will not be able to implement a "redirect" to canonicalise these requests (since the request no longer reaches your server). This is arguably how it should have been configured (or "not" configured) initially. (Google obviously won't index anything that does not resolve.)

However, in order to "fix" the already indexed pages and redirect the request/user to the canonical hostname (ie. exrx.net) you will need to (at least temporarily) reinstate the relevant DNS entry (eg. a CNAME record that points to the domain apex OR an A record that points to the sever's IP address). This is assuming the server is still configured to accept requests to this hostname. If not then this will need to be reinstated also (eg. a ServerAlias ftp.exrx.net directive in the relevant <VirtualHost> container). And possibly modify your SSL cert to include the ftp subdomain (ftp.exrx.net) in the SAN field, if that has also been removed.