user3108698
user3108698

Reputation: 719

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?

Upvotes: 1

Views: 1170

Answers (3)

user3108698
user3108698

Reputation: 719

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\">";
 }
?>

Upvotes: 2

There is an easier method than using noindex, nofollow. Use canonical links on your pages, using the production url. Like this, even if search engines find about your development pages, they won't index them.

Upvotes: 2

emmanuel
emmanuel

Reputation: 9615

When you move the files to the production server you don't have to copy configuration.php that store the variable for robots in public $robots = '';.

I highly recommend you to keep your development installation htaccess password protected to be sure that would never be accessed by search engines.

Hope this helps

Upvotes: 1

Related Questions