Created
November 29, 2012 00:13
-
-
Save mspivak/4165764 to your computer and use it in GitHub Desktop.
Different robots.txt files for HTTP and HTTPS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
#This will have the file processed by robots.php instead of a regular static file. | |
RewriteRule ^robots.txt$ /robots.php [L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-Type: text/plain; charset=utf-8"); | |
$protocol = $_SERVER['HTTPS'] ? 'HTTPS' : 'HTTP'; | |
echo file_get_contents(dirname(__FILE__).'/robots.txt.'.strtolower($protocol)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User-agent: * | |
Disallow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User-agent: * | |
Disallow: / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This tells robot crawlers to read every HTTP path and none HTTPS.