My site is not loading, as I get this error message when type in the URL:
Fatal error: Call to a member function rewrite() on a non-object in app/code/core/Mage/Core/Controller/Varien/Front.php on line 165
Does any one familiar with what could be wrong here?
Best Answer
If you look at the file to which magento points out, you can find the below line which comes inside
dispatch
methodFile :
app/code/core/Mage/Core/Controller/Varien/Front.php
The error says
rewrite()
is calling on anon-object
. This means that,$this->_getRequestRewriteController()
provides you anon-object
(most probably it returns an empty value).Why
$this->_getRequestRewriteController()
gives you anon-object
? In order to find the reason, let us have a look on this method definition.The method just trying to create a model instance of
$className
. Here$className
holds a value which is returned by$className = (string)Mage::getConfig()->getNode('global/request_rewrite/model');
. The default value which return by this call iscore/url_rewrite_request
. This means the method_getRequestRewriteController()
is supposed to return an instance of model classMage_Core_Model_Url_Rewrite_Request
by defalt.Based on this analysis, the error may be caused due to
You may have a wrong class name in the above specified node.
app/code/core/Mage/Core/etc/config.xml
is used to define this node value. Since it is a core file, alternation happens here may be a rare chance. There is a possibility of rewriting this node by any external plugins. So this should be validated first.Ultimately your magento application do not have the file which defines this class
Mage_Core_Model_Url_Rewrite_Request
which normally appers atapp/code/core/Mage/Core/Model/Url/Rewrite/Request.php
I have found out some threads, which gives a hint that permission problems on
var/cache
directory may also cause this weird issue.Hope that helps.