joomlametarobots.txtnofollownoindex

How to make development site Noindex Nofollow, but production without


I have a joomla 3.3 development site and a production site. I'm doing all development in the development site and every time that the development get pushed to production, I need to make sure I change noindex,nofollow to index, follow.

Anyway I can keep development noindex,nofollow without changing production?


Solution

  • Use a conditional php code inside the template head php file.

    <?php
    //if host is development show noindex
     $host = $_SERVER['HTTP_HOST']; 
     if($host == "development.com")
     {
         echo "<meta name=\"robots\" content=\"noindex, nofollow\">";
     }
    ?>