URLs with and without www gotcha

On April 7, 2011, in Browsers, by Anuj Gakhar

I was stuck today with a very strange issue and it’s definitely worth a blog post I think. The issue was as follows :

  1. A user visits the website at http://site.com
  2. User tries to pay for a Product via Paypal.
  3. Payment goes through fine – and Paypal sends the user back to the Return URL as specified in the initial call.
  4. User gets redirected to the login page instead of the payment confirmation page on the site.

I could not, for the life of me, figure out why the user was getting redirected. And to make matters worse, it was working fine in IE. But Firefox, Chrome and Safari all had the above issue.

The Solution :-

Turns out the Return URL specified initially was to www.site.com instead of http://site.com and therefore when the user got sent back to the site after the payment – the session was lost, resulting in a redirection to the login page. Obviously IE treats this differently than all other browsers. But it was good to get to the bottom of this, in the end.

 

4 Responses to URLs with and without www gotcha

  1. James Moberg says:

    We perform 301 redirect all GET requests to send visitors to the WWW version of the webpage that are requesting. I also prefer it because because you can also assign cookies that work across all sub-domains, but you can’t do this at the top-level domain name. In addition to domain-specific cookies, it’s also better for our logfiles.

    If you have a Google Web Developer account, you can also configure it so that all of search result links to your website send visitors to the “www” version of your website.

  2. Anuj Gakhar says:

    Hi James, Yes that is what I ended up doing as well. I added 301 redirects as a Apache Redirect Rule. However, setting this up in the Google Webmasters account is a good idea. Thanks for the tip.

  3. USA Grants says:

    This method was taught to us by a web developer who spoke at a Domain management seminar in Houston. Quite an interesting approach too.

  4. Well, I have to say that I too had ended up in such a situation not long ago. I did not know as to why PayPal didn’t show me the confirmation page since I was straightaway redirected to the login page. However, after enquiring with the support team of PayPal, they told me that this was an issue faced by most of the browsers at that time except Internet Explorer and that I should login with IE the next time until this issue was resolved in other browsers.

Leave a Reply to James Moberg Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2011 Anuj Gakhar
%d bloggers like this: