Zen Cart Logo
Forums / General Questions / 406 Error and template path in URL

406 Error and template path in URL

Views: 1,554

Results 1 to 11 of 11
4 Feb 2015, 2:23 AM
#1
stevensmedia avatar

stevensmedia

New Zenner

Join Date:
Jan 2006
Posts:
88
Plugin Contributions:
0

406 Error and template path in URL

I just moved a 1.5.1 Zen-Cart site to a new server (HostGator.)

The following links are generating a 406 error:
Log Out
My Account
Checkout

In the URLs, the template path is visible, ex:
https://www.mysite.com/shop/index.php?main_page=logoff&../../template_default/common

The server log seems to indicate that the template path is what's causing the error:
Directory not allowed here

Any advice for how to clear these errors up? Thank you in advance!

4 Feb 2015, 3:17 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 406 Error and template path in URL

stevensmedia:

I just moved a 1.5.1 Zen-Cart site to a new server (HostGator.)
Which of the steps in this article did you skip? http://www.zen-cart.com/content.php?142-i-want-to-move-my-zen-cart-installation-to-another-host-or-a-different-server

What's the URL?

If you sent ENABLE_SSL to 'false' does the problem stop? If so, then your SSL is to blame.

4 Feb 2015, 5:00 PM
#3
stevensmedia avatar

stevensmedia

New Zenner

Join Date:
Jan 2006
Posts:
88
Plugin Contributions:
0

Re: 406 Error and template path in URL

Thank you for you quick reply!

The step I skipped was running the Fix Key Cache tool. This has now been done:

Recommendations
Possible appropriate cache directory for your site is: /full/path/to/public_html/shop/cache

Actual Information
Read DIR_FS_SQL_CACHE from includes/configure.php: /full/path/to/public_html/shop/cache
Found SESSION_WRITE_DIRECTORY in database:

Now synchronizing...
Database now contains the following SESSION_WRITE_DIRECTORY:

Finished.

(I assume the blank value for SESSION_WRITE_DIRECTORY in the DB is correct. SQL_CACHE_METHOD is set to NONE in configure.php)

I tried disabling SSL in the two configuration files and the error persisted.

I looked in my custom template files and noticed that the path (that's apparently causing the problem) was in the code, like this:

<div id="login">
<?php if ($_SESSION['customer_id']) { ?>
<a href="<?php echo zen_href_link(FILENAME_LOGOFF, '../../template_default/common', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a><br /><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '../../template_default/common', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>
<?php
      } else {
        if (STORE_STATUS == '0') {
?>
<a href="<?php echo zen_href_link(FILENAME_LOGIN, '../../template_default/common', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a>
<?php } } ?>

<?php if ($_SESSION['cart']->count_contents() != 0) { ?>
<a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '../../template_default/common', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a><br />
<a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '../../template_default/common', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a>
<?php }?>
</div>

I removed the paths, so the links appear like:

<a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a>

That fixed the Account and Checkout links---they no longer generate a 406 error.

The Logoff link also no longer causes a 406 error BUT it also doesn't work--you're not logged out when you click the link.

A problem with sessions? The cache directory permissions are 755. Here are the store's sessions settings:

Session Directory /full/path/to/public_html/shop/cache
Force Cookie Use False
Cookie Domain True
Check SSL Session ID False
Check User Agent False
Check IP Address False
Prevent Spider Sessions False
Recreate Session False
IP to Host Conversion Status true
Use root path for cookie path False
Add period prefix to cookie domain True

I switched to the "Classic Contemporary Green" template and the problem persisted.

The URL of the site is: https://www.ritson-sole.com/shop/

Thanks again for any advice you can provide.

4 Feb 2015, 5:47 PM
#4
stevensmedia avatar

stevensmedia

New Zenner

Join Date:
Jan 2006
Posts:
88
Plugin Contributions:
0

Re: 406 Error and template path in URL

ps. The Fix Key Cache tool returned blank values for SESSION_WRITE_DIRECTORY but the database does contain a value which looks correct: /full/path/to/public_html/shop/cache

5 Feb 2015, 6:38 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 406 Error and template path in URL

stevensmedia:

ps. The Fix Key Cache tool returned blank values for SESSION_WRITE_DIRECTORY but the database does contain a value which looks correct: /full/path/to/public_html/shop/cache
No, it should neither be blank nor the literal text '/full/path/to/public_html/shop/cache'.

It should match whatever you've got in your /includes/configure.php file for DIR_FS_SQL_CACHE

5 Feb 2015, 4:43 PM
#6
stevensmedia avatar

stevensmedia

New Zenner

Join Date:
Jan 2006
Posts:
88
Plugin Contributions:
0

Re: 406 Error and template path in URL

Sorry for the confusion. The value in the DB DOES match what's in /includes/configure.php file for DIR_FS_SQL_CACHE. (The path does NOT include "/full/path/to"--I'm just using that here to not expose the actual server path.)

Any other ideas?

5 Feb 2015, 5:32 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 406 Error and template path in URL

Okay, so now the next step is to clearly identify EVERY way in which your site's PHP files are different from the original ZC distribution files.

5 Feb 2015, 5:34 PM
#8
stevensmedia avatar

stevensmedia

New Zenner

Join Date:
Jan 2006
Posts:
88
Plugin Contributions:
0

Re: 406 Error and template path in URL

Yes, I have a detailed list of this.

But I wasn't getting this error, with the same files, on the other server...?

5 Feb 2015, 6:01 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 406 Error and template path in URL

stevensmedia:

But I wasn't getting this error, with the same files, on the other server...?
I understand that, and I agree that that's frustrating. But nobody here knows exactly the differences between those 2 servers.

So, there are 2 possibilities:
a) the problem is still in your own modifications to the code, and the old server configuration let you get away with it.
b) or there's something misconfigured on your server ... in which case you'll want to obtain a detailed list of all configuration settings for PHP and MySQL and Apache and mod_security and firewalls and vhosts from both servers, and isolate which differences are causing your symptoms.

I've never seen these sort of symptoms running Zen Cart on Hostgator servers, so it makes me suspicious of your alterations.

A brand new fresh uncustomized install might be revealing.

6 Feb 2015, 2:48 AM
#10
stevensmedia avatar

stevensmedia

New Zenner

Join Date:
Jan 2006
Posts:
88
Plugin Contributions:
0

Re: 406 Error and template path in URL

A brand new, fresh, uncustomized install worked without problems.

I then copied over my customized files from the non-working installation, into the new working install, switched the database configuration to the non-working install's DB, and... everything continues to work.

So, I assume the problem was due to a corrupted upload when I first moved the site over.

Thanks for your guidance!

6 Feb 2015, 3:55 AM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 406 Error and template path in URL

Glad it's working properly now!