I learned today that our website was throwing 404s on many of our category pages. The only process that I think that could have triggered this was the execution of magerun index:reindex:all which had been processed a few times today.

  • The category is a child category of products with a slug of products
  • A URL slug is set in the category settings: as shirts
  • A URL Redirect rule exists for the matching category slug (products/shirts) request path and store
  • The URL redirect has a target path of catalog/category/view/id/25.
  • https://www.domain.com/product/shirts should render https://www.domain.com/catalog/category/view/id/25 - it does not.
  • https://www.domain.com/catalog/category/view/id/25 renders the category as expected.
  • Reindexing does not resolve the issue
  • I am able to render the category at https://www.domain.com/products/shirts if I make the following change to Enterprise_UrlRewrite_Model_Url_Rewrite_Request::_loadRewrite()

     * Load rewrite model
     * @return Enterprise_UrlRewrite_Model_Url_Rewrite_Request
    protected function _loadRewrite()
        $requestPath = $this->_getRequestPath();
        $paths = $this->_getSystemPaths($requestPath);
        if (count($paths)) {
        /** START: Temporary patch to bring categories back online */
        // if ($this->_rewrite->getId() && !$this->_rewrite->getIsSystem()) {
        //    /**
        //     * Try to load data by request path from redirect model
        //     */
        //     $this->_rewrite->setData(
        //        $this->_getRedirect($requestPath, $this->_rewrite->getStoreId())->getData()
        //     );
        /** END: Temporary patch to bring categories back online */
        return $this;

In my commented-out code, I see that !$this->_rewrite->getIsSystem() is returning true which allows the loaded category to be replaced with a "broken" redirect. Does Magento expect category URLs to have a true value on getIsSystem()? I'm just not sure where this is breaking down at.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.