Last active
December 15, 2022 21:01
-
-
Save kwcjr/b38a07f8e1c4cabb6e75e4fe6ca8c1dc to your computer and use it in GitHub Desktop.
Append content to Robots.txt
This file contains hidden or 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 | |
/** | |
* Snippet Action: Append content to Robots.txt | |
* Snippet Type: Return info from Child Sites. ( IMPORTANT! This will make it run one time ) | |
* Snippet Author: Keith Crain ( MainWP.com ) | |
*/ | |
// The string you want to add. | |
$txt = " | |
################################################################### | |
# The Ultimate robots.txt Bot and User-Agent Blocker | |
# Copyright: | |
# https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker | |
################################################################### | |
"; | |
$myfile = file_put_contents('robots.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment