02.20.06
A missing forward slash.
I’ve been having some trouble again recently with a website I did for a client. This problem had reared its head before, and I could never pin down what was causing it until recently.
The problem is when at a certain point visitors to a site start viewing the non ‘www’ version of your site so
visitor goes to www.mycoolsite.com/shop/buysomething.php
and then later they arrive at
mycoolsite.com/shop/checkout.php
This isnt a huge issue except that it messes up cookies and lots of shopping carts are based on cookies. So the user gets to the check out and finds that there is no longer anything in their cart. Now I noticed this early on and tried to take steps to prevent it, but it has reared its head, and for reasons I wont go into, this time I had to track down the cause. And I finally did. A missing forward slash!
If you make a link to a directory (relative or absolute) without a trailing / it will redirect to the www less version of the url, so
www.mydomain.com/shop will load mydomain.com/shop/index.php
whereas
www.mydomain.com/shop/ will load www.mydomain.com/shop/index.php
now usually there is no difference, but in certain circumstances this can mess up things like cookies. So dont let it catch you out.
The origional answer I found is here.
http://www.weather-watch.com/smf/index.php?topic=7265.msg48681#msg48681
I admit a weather-watch website is rather an obscure place