Keyword

SECURITY: category-name/anything shows blank page instead of 404

  • Todd Allen
  • Todd Allen's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 10 months ago #90230 by Todd Allen
Not quite sure what's going on here but I have confirmed on multiple sites excluding my own. If you go to yourdomain.com/category-name/write-anything-here, you will get a blank page instead of a 404 error.

Here are a couple examples of what I'm talking about (example sites taken from the K2 homepage):

www.tangentproducts.com/stories/ANYTHING

www.digi-doc.com/products/ANYTHING

www.pefc.org/index.php/news-a-media/general-sfm-news/news-detail/ANYTHING

I have written some .htaccess rules to help target some of the issues on my site but it's really a band-aid. This should result in a 404 error.

Ideas? K2 development team?

Please Log in or Create an account to join the conversation.

More
13 years 10 months ago #90231 by yireo
Hi,

I experienced the same problem. By modifying the file "components/com_k2/k2.php" you can fix this.

Original:
if (JFile::exists(JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php')) { require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
$classname = 'K2Controller'.$controller;
$controller = new $classname();
$controller->execute(JRequest::getWord('task'));
$controller->redirect();
}

Change:
if (JFile::exists(JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php')) { require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
$classname = 'K2Controller'.$controller;
$controller = new $classname();
$controller->execute(JRequest::getWord('task'));
$controller->redirect();
} else {
JError::raiseError(404, JText::_("Unsupported method"));
}

Hope this helps.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum