【问题标题】:block mobile (iOS / Android) access to a single CMS page in magento阻止移动(iOS / Android)访问magento中的单个CMS页面
【发布时间】:2012-05-20 18:49:14
【问题描述】:

在 apache 中,我想我可以执行类似 .htaccess 访问控制选项的操作。

例如: SetEnvIf 用户代理 BadBot GoAway=1 命令允许,拒绝 允许所有人 来自 env=GoAway 的拒绝

但是如何在 magento 中阻止移动(iOS / Android)访问单个 CMS 页面????

【问题讨论】:

    标签: .htaccess magento


    【解决方案1】:

    CMS router's match 方法观察cms_controller_router_match_before 事件,并在观察者方法中检查用户代理标头。有可能,请参考this SO post

    public function checkRestrictAccess(Varien_Event_Observer $o)
    {
        /**
         * Browser detection logic will go here.
         */
    
        if (mobile browser == true && $o->getCondition()->getIdentifier() == 'page-id') {
            $o->getRequest()->setRedirectUrl(Redirect Url);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-29
      • 1970-01-01
      • 2017-09-02
      • 2017-08-01
      相关资源
      最近更新 更多