Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

mod_rewrite causing a loss of SID / item


Vestax159

Recommended Posts

Posted

So testing out a mod_rewrite and I haven't changed tep_href function yet but I have an issue with losing the SID or item during checkout. As I browse the site the items remain the problem occurs at shopping_cart.php

 

http://accessofficeproducts.com/shopping_cart.php?osCsid=d7421b2cbbfe22f7b39557b944e291ad - Current URL

http://accessofficeproducts.com/shopping_cart/osCsid=d7421b2cbbfe22f7b39557b944e291ad - Mod_Rewrite which loses items

Posted

I'm not using any SEO add-ons as I have changed the oscommerce site so much it's no longer an easy addition. I went ahead and tried to use the one in your link but as I said it's so customized it breaks even if properly installed.

Posted

That's strange. Ultimate SEO V2.2 is one of the easiest installs, even on heavily changed shops. If you are trying to do the change yourself without using a contribution, then you are redoing years worth of work and research. Your time would be better spent in getting the contribution to work, in my opinion. Plus, it is unlikely anyone will be able to help you, in these forums, with specialized coding since there isn't any reference for it.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted

I went ahead and posted my error on the SEO thread. I was incorrect earlier, it seems like the shopping cart is losing track of the items as I follow links that are using mod_rewrite so it has to be logging the osCid somewhere along the way.

Posted

Yes, I would use (or use as a base/inspiration) one of the existing "SEO" add-ons. Much easier than re-inventing the wheel.

 

You state "mod rewrite that doesn't work"... what you show there is a "static" (SEO-style) URL. That should be your incoming (from an internal link) URL, which your .htaccess file converts to the dynamic form you show before the static URL. Have you got it in the right order? I've seen people take incoming dynamic URLs (like your first one) and rewrite them to a static form and wonder why it doesn't work (they've got it backwards). By the way, only internal links should use the osCsid field... (if it's used at all). External links (bookmarks, search engines indexes) should never have a session-specific ID.

 

If you do have it in the right order (incoming static form being converted to dynamic), it sounds like your .htaccess (or other rewrite code, such as in PHP) isn't coded correctly, and is dropping part of the URI. If you want to, post your .htaccess code doing the rewrite and we can look at it.

Posted

Options +FollowSymLinks
RewriteEngine on
RewriteRule about/(.*)=(.*)/$ /about.php?$1=$2

 

Just doing something pretty simple to test it out. If an item is in the cart it displays correctly until moving to this link. Which is the rewritten version of the link below it.

 

http://accessofficeproducts.com/about/osCsid=8cb29f8bab07e250c5e617bb61750a9b

 

http://accessofficeproducts.com/about.php?osCsid=8cb29f8bab07e250c5e617bb61750a9b

 

EDIT: Think I found the issue, I'm dropping off the / at the end of the URL.

Posted

You're mandating that there be a trailing "/" on the static form. Your example doesn't have one, so it's not being rewritten. Try

Options +FollowSymLinks
RewriteEngine on
RewriteRule about/(.*)=(.*)/?$ /about.php?$1=$2

to make the trailing / optional. You might also be swallowing the "=" as part of the $1, and/or "/" as part of the $2, so you might have to do this:

Options +FollowSymLinks
RewriteEngine on
RewriteRule about/([^=]+)=([^/]+)/?$ /about.php?$1=$2

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...