Magento category redirect cuts off the querystring of an url

后端 未结 3 661
暗喜
暗喜 2021-01-26 13:25

we are running a Magento 1.4.2.0 Webshop with google analytics. As we all know google attaches a querystring called the \"gclid-Param\" to the url.

The customer clicks t

3条回答
  •  星月不相逢
    2021-01-26 14:03

    In 1.9.1.0 this problem could be solved through patching in another class Mage_Core_Model_Url_Rewrite_Request/function _processRedirectOptions().
    Just add after code

        $targetUrl = $this->_request->getBaseUrl() . '/' . $this->_rewrite->getTargetPath();
    
        $storeCode = $this->_app->getStore()->getCode();
        if (Mage::getStoreConfig('web/url/use_store') && !empty($storeCode)) {
            $targetUrl = $this->_request->getBaseUrl() . '/' . $storeCode . '/' . $this->_rewrite->getTargetPath();
        }
    
        if ($this->_rewrite->hasOption('R') || $isPermanentRedirectOption) {
    

    the following

                $queryString = $this->_getQueryString();
                if ($queryString) {
                    $targetUrl .= '?'.$queryString;
                }
    

    and make sure 'if' statement keep closed with

               $this->_sendRedirectHeaders($targetUrl, $isPermanentRedirectOption);
        }
    

    I'm sure it's fairly enough because of you don't need to transfer query string for external redirects.

    Happy coding

提交回复
热议问题