Skip to content

Instantly share code, notes, and snippets.

@hyhoocchan
Last active September 28, 2015 03:46
Show Gist options
  • Select an option

  • Save hyhoocchan/3e5ca0d00eb18d9ad02e to your computer and use it in GitHub Desktop.

Select an option

Save hyhoocchan/3e5ca0d00eb18d9ad02e to your computer and use it in GitHub Desktop.
Use more robot field on multi site magento
<?php
/**
* Created by PhpStorm.
* User: chan
* Date: 21/09/2015
* Time: 16:04
*/
require_once 'Mage/Cms/controllers/IndexController.php';
class Forix_Custom_IndexController extends Mage_Cms_IndexController {
/**
* Render CMS 404 Not found page
*
* @param string $coreRoute
*/
public function noRouteAction($coreRoute = null)
{
if($_SERVER["REQUEST_URI"]=="/robots.txt"){
switch($_SERVER["SERVER_NAME"]){
case "sub1.oursite.local":
case "sub1.oursite.com"://Sub domain use other file
{
$file = Mage::getBaseDir(). "/robots_other.txt";
break;
}
default:{//default domain use other file
$file = Mage::getBaseDir(). "/robots_default.txt";
}
}
if(file_exists($file)){
$this->getResponse ()
->setHttpResponseCode ( 200 )
->setHeader ( 'Content-type', 'text' );
$this->getResponse ()->clearBody ();
$this->getResponse ()->sendHeaders ();
readfile ( $file );
exit;
}
}
return parent::noRouteAction($coreRoute);
}
}
User-agent: Googlebot
Disallow:
User-agent: Googlebot-image
Disallow:
User-agent: *
# Directories
Disallow: /404/
Disallow: /app/
Disallow: /manage/
Disallow: /cgi-bin/
Disallow: /downloader/
Disallow: /includes/
Disallow: /js/
Disallow: /lib/
Disallow: /magento/
Disallow: /media/
Allow: /media/catalog/product/
Disallow: /pkginfo/
Disallow: /report/
Disallow: /scripts/
Disallow: /shell/
Disallow: /skin/
Disallow: /stats/
Disallow: /var/
# Paths (clean URLs)
Disallow: /catalog/product_compare/
Disallow: /catalog/category/view/
Disallow: /catalog/product/view/
Disallow: /catalog/product/gallery/
Disallow: /catalogsearch/
Disallow: /checkout/
Disallow: /control/
Disallow: /contacts/
Disallow: /customer/
Disallow: /customize/
Disallow: /newsletter/
Disallow: /poll/
Disallow: /review/
Disallow: /sendfriend/
Disallow: /tag/
Disallow: /wishlist/
Disallow: /index.php
Disallow: /tag/
Disallow: /cron.php
Disallow: /cron.sh
Disallow: /error_log
Disallow: /install.php
Disallow: /LICENSE.html
Disallow: /LICENSE.txt
Disallow: /LICENSE_AFL.txt
Disallow: /RELEASE_NOTES.txt
Disallow: /STATUS.txt
Disallow: /get.php
Disallow: /.sample$
Disallow: /mage
Disallow: /.js$
Disallow: /?___from_store=
Disallow: *___from_store=
Disallow: /?mode=
Disallow: /?limit=
Disallow: /?dir=
Disallow: /.css$
Disallow: /.php$
Disallow: /.ico$
Disallow: /?p=*&
Disallow: /?SID=
Disallow: /rss*
Disallow: /home/
Disallow: /home-page/
sitemap: http://oursite.local/sitemap.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment