Jump to content

All category links will generate “Page not found” in stats, frontoffice looks good... [Solved]


Recommended Posts

Hi folks, I noticed recently that my page ranking was dropping and while searching for the reasons, I noticed that when clicking on any of the category links, it will generate “Page not found” in stats, but everything is fine from the website point of view (No Page not found error).

 

This is happening from either accessing the links via the “Top Bar Menu” or the “Categories” links on the left column.

 

I am on Prestashop 1.6.0.14.

 

I tried to regenerate the .htaccess file by disabling and enabling the “Friendly URL” under Preferences/SEO & URLs and also tried disabling Apache's MultiViews option and disabling Apache's mod_security module in backoffice.

 

See pics for clarification…

 

post-406825-0-11584300-1428338897_thumb.png

post-406825-0-65392300-1428338915_thumb.png

 

Any ideas what could be the cause of this?

 

Cheers

Dan

Edited by papagino (see edit history)
Link to comment
Share on other sites

Hi Nemo1, thanks for your reply...

 

I did create an override for the Dispatcher class to fix this error I was getting when looking at my host Error logs:

 

Warning: parse_url(/login?multi-shipping=0&display_guest_checkout=1&back=http://www.mysite.com/en/order?step=1&multi-shipping=0) [function.parse-url]: Unable to parse URL in /xxxxxx/xxxxxxxxxxxx/public_html/classes/Dispatcher.php on line 746.
 

 

I changed line 746 in classes/Dispatcher.php

From:

if (!preg_match('/\.(gif|jpe?g|png|css|js|ico)$/i', parse_url($this->request_uri, PHP_URL_PATH)))

to:

if (!preg_match('/\.(gif|jpe?g|png|css|js|ico)$/i', parse_url( Context::getContext()->language->iso_code . $this->request_uri, PHP_URL_PATH)))

 

 

 

But, to check if this was the problem, I delete the override/classes/Dispatcher.php file then I deleted the /cache/class_index.php file in order to reinstate the default behavior.

I also cleared the cache and did a "Force compilation" in my Backoffice but the problem still persist.

 

 

Any ideas what is causing this?

 

Thank you for your help...

 

Dan

Link to comment
Share on other sites

Thanks Nemo1, I have search the whole root on my host and there are no folder named 'none'.

 

If you look at the first picture on the bottom left in my first post, you will see that it is in fact redirected to "none-admin404"

(I had the mouse on the "/en/none" page link when I took the screenshot)

 

This is affecting ALL category links, either from the top bar or from accessing categories via the left column.

Could this be caused by my premium theme? (I am not on the default-bootstap theme).

 

Please note that everything looks fine from the website, you don't get any errors, it is just that Prestashop is generating a "Pages not found" in the Stats Report...

 

If you look at the following sceenshot, you will see that Firebug shows that the category links are in fact pointing to the right pages...

 

post-406825-0-20084500-1428499815_thumb.png

 

Also, I get these errors (probably not related) from my host Error Logs:

[06-Apr-2015 14:01:57] PHP Fatal error:  Uncaught  --> Smarty: Missing template name <-- 
  thrown in /home1/xxxxxxx/public_html/tools/smarty/sysplugins/smarty_internal_template.php on line 678
[07-Apr-2015 19:26:28] PHP Warning:  parse_url(/login?back=https://www.miraxsupplements.com/fr/order?step=1&display_guest_checkout=1) [<a href='function.parse-url'>function.parse-url</a>]: Unable to parse URL in /home1/xxxxxxx/public_html/classes/Dispatcher.php on line 746

/home1/xxxxxxxx/public_html/js/error_log:
[07-Apr-2015 09:03:45] PHP Parse error:  syntax error, unexpected T_ARRAY, expecting ')' in /home1/xxxxxxxx/public_html/js/retro-compat.js.php on line 71

This is weird!

 

No ideas what is causing this...

 

Cheers

Dan

Link to comment
Share on other sites

Hello again Nemo1

 

When I check the "Configuration information" under "Advanced Parameters" in my backoffice, I noticed that under "Please fix the following error(s)" , magicquotes was mentionned. I turned magicquotes to off in the php.ini file and the warning shown in the picture in now gone.

 

Also, it shows that I am missing 2 files: .gitignore and .gitmodules?

 

Any ideas what are those files?

 

See pics for details:

 

 

post-406825-0-16732800-1428596840_thumb.png

 

 

Cheers

Dan

Edited by papagino (see edit history)
Link to comment
Share on other sites

Oh, that page is not worth any trust, sometimes it's just wrong. But in any case those files are nothing relevant.

So, the link is indeed pointing to the right page. In this case, I think the canonicalRedirection() method of the category controller is giving you troubles. Is that overridden as well? That, or the frontController's one

Link to comment
Share on other sites

Thanks for your help Nemo1.

 

When checking in the override folder, the only files in there are the Dispatcher.php and Carrier.php located under "override/classes".

All other folders under override only have the "index.php" files in them.

 

The Dispatcher.php file is the same as the original Prestashop file except that I changed line 746:

From:

if (!preg_match('/\.(gif|jpe?g|png|css|js|ico)$/i', parse_url($this->request_uri, PHP_URL_PATH)))

to:

if (!preg_match('/\.(gif|jpe?g|png|css|js|ico)$/i', parse_url( Context::getContext()->language->iso_code . $this->request_uri, PHP_URL_PATH)))

 

to fix an error I was getting in the Host Errors Logs.

 

And the Carrier.php file was probably inserted there from my Canada Post Shipping module - by Presto-Changeo.

 

Other than that, there are no other overrides.

 

 

In the "controllers/front/CategoryController.php" file, around line 55, here are code related to canonicalRedirection...

	$this->addJS(_THEME_JS_DIR_.'category.js');
	}

	public function canonicalRedirection($canonicalURL = '')
	{
		if (Tools::getValue('live_edit'))
			return;
		if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop() || in_array($this->category->id, array(Configuration::get('PS_HOME_CATEGORY'), Configuration::get('PS_ROOT_CATEGORY'))))
		{
			$this->redirect_after = '404';
			$this->redirect();

Could this problem be cause by my premium theme?

 

Cheers

Dan

Link to comment
Share on other sites

Hi Nemo1,

 

Ok, here's what I did, I place the shop under maintenance, disabled friendly urls then emptied all "pages not found" notices in the BO.

 

Now, the only "pages not found" notice I will get is "/none" with "www.miraxsupplements.com/index.php" as the "Referrer", even though I did not click on any links pointing to the shop homepage, only a Category link? (There is no URL rewrite assigned to my homepage under "Preferences/SEO & URLs" in Backoffice).

 

I also know that this was not generated from someone else trying to access my page because I had Google Analytics Real Time Overview on while doing this test and nobody was on my page.

 

Notice that the "Page not found" is pointing to "/none" when clicking a category link with "Friendly URL disabled" and pointing to "/en/none" when "Friendly URL is enabled".

 

My site is available in both English (.../en/...) and French (.../fr/...).

 

Could this be cause by a translation problem?

 

See pics for details:

 

post-406825-0-73384000-1428930107_thumb.png

post-406825-0-51975600-1428930108_thumb.png

 

Thanks for your help...

 

Dan

Edited by papagino (see edit history)
Link to comment
Share on other sites

Well, turns out that the problem with "Page not found" was related to my premium theme after all.

 

I verified the theme maker to see if there was an update for Prestashop 1.6.0.14 and there was.

I updated the Premium Theme and no more "Page not found".

 

Thanks Nemo1 for all your help.

 

Cheers

Dan

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...