Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

redirect not serving proper header
 
rgoodrow
Member
 
Total Posts:  31
Joined:  2013-04-23
 

I’m trying to server a redirect if a customer attempts to download a file from our site that doesn’t exist.

I use a custom controller to handle the file, and within the controller, a simple check for file_exists(), and if it doesn’t, the following is run

$pageId Mage::getStoreConfig('web/default/cms_no_route');
            
$url rtrim(Mage::getUrl($pageId),'/');
            
Mage::app()->getFrontController()->getResponse()->setRedirect($url404);
            
$this->_redirect('cms/index/noRoute');
            return;

the problem is that while it’s redirecting to my defualt 404 page, the initial status code being sent is 302, then followed by a proper 404.

[16:51:36.955] GET http://localhost/download/get/?id=34416&chapter;=0 [HTTP/1.1 302 Found 737ms]
[16:51:37.711] GET http://localhost/cms/index/noRoute/ [HTTP/1.1 404 Not Found 2900ms]

how can I get the initial request to serve the proper 404.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top