Post by DoctorDredd » Sun Mar 26, 2023 6:19 pm

Hello everyone. Unfortiontly not working 404 page. Have massege
The requested URL /favicon.ico was not found on this server.
Tried to swich off seo url but the same situation.

How to start working page 404?

Thank you in advance.

/catalog/controller/error/not_found.php

Code: Select all

<?php   
class ControllerErrorNotFound extends Controller {
	public function index() {		
		$this->language->load('error/not_found');

		$this->document->settitle($this->language->get('heading_title'));

		$this->data['breadcrumbs'] = array();

		$this->data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/home'),
			'separator' => false
		);

		if (isset($this->request->get['route'])) {
			$data = $this->request->get;

			unset($data['_route_']);

			$route = $data['route'];

			unset($data['route']);

			$url = '';

			if ($data) {
				$url = '&' . urldecode(http_build_query($data, '', '&'));
			}	

			if (isset($this->request->server['https']) && (($this->request->server['https'] == 'on') || ($this->request->server['https'] == '1'))) {
				$connection = 'ssl';
			} else {
				$connection = 'nonssl';
			}

			$this->data['breadcrumbs'][] = array(
				'text'      => $this->language->get('heading_title'),
				'href'      => $this->url->link($route, $url, $connection),
				'separator' => $this->language->get('text_separator')
			);
		}

		$this->data['heading_title'] = $this->language->get('heading_title');

		$this->data['text_error'] = $this->language->get('text_error');

		$this->data['button_continue'] = $this->language->get('button_continue');

		$this->response->addheader($this->request->server['SERVER_PROTOCOL'] . '/1.1 404 not found');

		$this->data['continue'] = $this->url->link('common/home');

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
		} else {
			$this->template = 'default/template/error/not_found.tpl';
		}

		$this->children = array(
			'common/column_left',
			'common/column_right',
			'common/content_top',
			'common/content_bottom',
			'common/footer',
			'common/header'
		);

		$this->response->setoutput($this->render());
	}
}
?>

Newbie

Posts

Joined
Wed Jul 29, 2020 7:38 pm

Post by IP_CAM » Sun Mar 26, 2023 8:53 pm

Just upload a favicon.ico into your OpenCart Folder, and it will work.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by DoctorDredd » Sun Mar 26, 2023 11:16 pm

IP_CAM wrote:
Sun Mar 26, 2023 8:53 pm
Just upload a favicon.ico into your OpenCart Folder, and it will work.
Hello IP_CAM!
I would like to repair opencart's 404 page for Cloudflare scanning this 404 page as well as all pages of the site, if possible.
And today actually today some "hacker" each 5 min tried to get favicon.ico. Three days ago we had our site attack. Right now I need to take more care about security.

IP_CAM may I ask you, is it even possible to hack a site by constantly sending get requests for files that don't exist?

Newbie

Posts

Joined
Wed Jul 29, 2020 7:38 pm

Post by IP_CAM » Mon Mar 27, 2023 1:09 am

Well, it's very unlikely, that such requests lead to problems, as long as an OC Installation is located on a decent server, or then, it would be very easy to kill any Site, by calling non-existing files.

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by DoctorDredd » Mon Mar 27, 2023 2:40 am

IP_CAM wrote:
Mon Mar 27, 2023 1:09 am
Well, it's very unlikely, that such requests lead to problems, as long as an OC Installation is located on a decent server, or then, it would be very easy to kill any Site, by calling non-existing files.
If make a redirect via .htaccess to the main page of the site in case of a 404 error (file does not exist), will this create a hole in the security of the site?

Newbie

Posts

Joined
Wed Jul 29, 2020 7:38 pm

Post by ADD Creative » Mon Mar 27, 2023 9:50 pm

Web browsers automatically request favicon.ico for each site they visit. What you are seeing is your host's 404 page. Ask your host how to change it.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by DoctorDredd » Tue Mar 28, 2023 3:00 am

ADD Creative wrote:
Mon Mar 27, 2023 9:50 pm
Web browsers automatically request favicon.ico for each site they visit. What you are seeing is your host's 404 page. Ask your host how to change it.
ADD Creative hello. Perhaps the hacker has minimized the browser to the Windows taskbar. And so we had a request every 5 minutes. In any case, thanks for the reply!

Newbie

Posts

Joined
Wed Jul 29, 2020 7:38 pm
Who is online

Users browsing this forum: No registered users and 69 guests