Quick Nav:  Online Store   |   Login | Register

Removing www

Rate this topic:

Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
AuthorMessages
SAD5643
<20 Posts
Posts:13


07/14/2008 8:44 AM  

Hi John

I have a site with one payment page that requires a security certificate.  The security certificate is without "www".  What is the simplest way to remove the www with PB and comply with the security certificate.  It can be sitewide or just for the payment page.

 

John Mitchell
Posts:3471


07/14/2008 10:15 AM  

If you just want to change it when you switch to SSL then you can use the javascript method that I use on this site.




var secureUrlPattern='login|Cart|/590/';
 if(location.protocol.toLowerCase()=='http:' && location.href.match(secureUrlPattern))
     location.href=location.href.replace('http:','https:').replace('www','');
 else if(location.protocol.toLowerCase()=='https:' && !location.href.match(secureUrlPattern))
      location.href=location.href.replace('https:','http:');

The first IF statment in the code above is looking to see if you're using http and on the login page. If so, it then tells the browser to switch to the same location but use SSL. The second IF statment does just the opposite, so any time you are on a page with the word "login" in the url it will tell the browser to use SSL, if you are not on a url with "login", then it will switch back. I have three different things that will make it switch ( login, cart, and /590/). You can add more by separating each with a pipe symbol |. That is all you need, paste this at the top of your page, (or skin in DotNetNuke), or include it in an external Javascript file that is linked in.
Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.



ActiveForums 3.7
Powered by: Snapsis Software