php - How to set primary domain on a VPS to 404 to remove from Google index? -
i have vps hosting package primary domain:
www.exampleprimary.com
with numerous addon domains.
i don't have website setup exampleprimary.com after going on earlier, learnt showing "index of/" , showing list of addon domains. not want happen added index.html show blank domain instead.
i learnt google had indexed primarydomain , still shows addon domains, want remove index.
i made index.html file:
<html> <head> <meta name="robots" content="noindex"> </head> <body></body> </html> i want set exampleprimary.com domain show 404 error ensure google bots remove domain index. can't domain return http 404 response. created .htaccess , added exampleprimary.com root:
errordocument 404 "<h1>page not found</h1>" errordocument 404 http://www.exampleprimary.com/ but after running tests on 404 checkers, still returns "200 ok" response.
how can make respond 404?
if want php can remove index.html , add index.php file this
<?php header("http/1.0 404 not found"); echo "<!doctype html public \"-//ietf//dtd html 2.0//en\"> <html><head> <title>404 not found</title> </head><body> <h1>not found</h1> <p>the requested url " . $_server['request_uri'] . " not found on server.</p> <hr> <address>server @ " . $_server['server_name'] . " </address> </body></html>"; exit(); ?> but going better if kind of configurations in webserver.
it seems using apache, seeing "index of" guess because directory listing enabled, disable option in apache , see default 404. add .htaccess file (or better in vhost definition).
options -indexes
Comments
Post a Comment