How to Block Subdomains in PHP
Your PHP-powered Web server responds to any user or search engine that browses your website. If you’ve created a subdomain with duplicate content, it's best to block search engines from accessing those pages. You use the "robots.txt" file to block subdomains from being crawled. This file is a plain text file that you can create and edit using Notepad. It must be placed in the root directory on your Web server.
Instructions
-
-
1
Click the Windows "Start" button and type "notepad" in the search box. Press "Enter" to launch the Notepad text editor. Open a new document.
-
2
Copy and paste the following code into the new document:
User-agent: *
Disallow: / -
-
3
Save the file and make sure you name it "robots.txt".
-
4
Open your server console or control panel. Each hosting provider has its own interface, so follow the usual procedure to log in and then navigate to the root folder of your subdomain.
-
5
Upload the robots.txt file to the subdomain's root directory on your PHP Web server. Search engines are now blocked from all directories and files on this subdomain.
-
1