We recently upgraded from 1.10 to 1.13 and are having some problems with our home page. All other cms pages are functioning properly, but the home page is consistently returning a cms 404. It doesn't matter which cms page we choose to be the home page, it always returns 404.
The store view is properly set, the homepage 'url' is set to cms, and i can't find any entries in core_url_rewrite with an empty request_path field.
Everything worked fine in our dev environment.
As a stop gap fix until we find a real solution, we have magento's 404 page set to load the cms page that is supposed to be used in the actual home page. Users don't notice a difference, but the home page of our site is still technically throwing a 404.
Any thoughts on what is going on here?
EDIT
The culprit was a product with an empty url key. Up until now, there were some cases in our product upload workflow where a product would get added to magento from our erp before it has a name. The url key is generated based on the product name, so these products have no url key. In 1.10 this apparently wasn't a problem. 1.13 however, treats that as though we entered the document root as the url key. Since Product url redirects supersede cms redirects, magento was trying to point to this product. It was returning 404 because the product was marked as 'not visible individually'.
Best Answer
You're not going to get out of this without a little debugging. The following applies to Magento CE, but should be relevant for Magento EE. Also, this post summarizes a lot of material found in my Magento Dispatch series. If you want to really engage in some bottom up debugging, start there.
To start, most of the Magento problems I see boil down to "I was really sure this one thing was X, but it was actually Y". Even if you're absolutely sure about something I tell you to check, make sure you actually check it.
The routing for Magento's homepage is handled by the
Mage_Core_Controller_Varien_Router_Standard
object. The first key part is this lineThe
_getDefaultPath
method looks at your Magento store config for the set value.which is the configuration that corresponds to
Tripple check that this value is set to the string
and that your
core_config_data
tabledoesn't contain any unexpected scoped values.
Once you've done the above, add some temporary debugging code to peek at the value of
$p
after that call.You should see output something like this
The reason you have two items being dumped/logged is the
match
method is shared between the admin router and the standard router object. If the second item isn't a one element array withcms
, that's your problem. Figure out what that's not happening, and you'll be on your way to solving the problem.Assuming that's not the problem, Magento should now dispatch to the
indexAction
method in theIndexController.php
file in theMage_Cms
module. Ensure this is the case by adding the following two lines to the start ofindexAction
You should see
Mage_Cms_IndexController::indexAction
dumped to the browser window. If this doesn't happen, then there's something about your system that's preventing standard routing from being used — jump back up into thematch
method and figure out why$controller
,$controllerClassName
,$controllerInstance
, and$action
variables don't point to theindexAction
method in theIndexController.php
file in theMage_Cms
module. (If this is the case, say so in the comments and I'll provide an update debugging scanrio for this)Assuming you are being routed to this controller file and action correctly, remove the
and instead add a new
var_dump
Magento allows you to configure the identifier of the page that should be used as the home page. The
Mage_Cms_Helper_Page::XML_PATH_HOME_PAGE
should corresponds with the store config pathweb/default/cms_home_page
, which corresponds with thesection. This is where you tell Magento which CMS page you want to use as your homepage. You should see something like
or
or etc. dumped to your screen. This is the CMS home page identifier. If you're setting an unexpected value, try running the following
to check for scoped values. Regardless of what you CMS Home Page ID is, check for the page's existence with the following SQL statement (assuming a value of
home
).If Magento can't find the configured page in your system, it will forward to the 404 page. You can see that with the following code in
indexAction
If
renderPage
returnsfalse
, then we're forwarded to thedefaultIndexAction
method which renders the 404 page.That should be enough to find 90% of your "no route to homepage" problems, and point you in a debugging direction for the other 10%.