Solved

Ho do I stop HTTPS:// from being passed to every page after the first time?

Posted on 2007-03-22
8
996 Views
Last Modified: 2012-05-07
Whenever someone hits an SSL page and goes back into a regular page, the https:// sticks to every page afterwards. How do I prevent this from happening? Do I have to put a PHP or ASP code that checks for this on every page that doesn't ever need to be SSL?
0
Comment
Question by:bemara57
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 20

Expert Comment

by:steelseth12
ID: 18776484
You can use absolute paths e.g http://www.example.com/mypage.php
0
 
LVL 10

Expert Comment

by:ClickCentric
ID: 18776548
Yes.  But why would you?  If the page works, it shouldn't matter if you're using http or https as long as the site has a vaild ssl certificate.
0
 

Author Comment

by:bemara57
ID: 18776699
The reason is because it put unnecessary strain on the server. Also steelseth, as simple as using absolute paths sounds, it wouldn't be good because my forwarded domains would get switched to the master domain, even if the forwarded domains are masked.

Is there any better way? I mean doing a find/replace to just replace the https to http in the location.address would be much easier than changing all my links to include full paths. But is there any native functions to ASP, PHP or even Apache?
0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
LVL 5

Accepted Solution

by:
Oscurochu earned 500 total points
ID: 18776704
i agree with ClickCentric, but i will help anyways

<script type="text/javascript">
<!--//Hide from old browsers
document.onload=function(){
  if ( this.location.href.indexOf('https://') ) {
    this.location.href = 'http://'+this.location.href.replace("https://", '');
  }
}
//-->
</script>


its a start, you can fix it to how you need it.
0
 

Author Comment

by:bemara57
ID: 18776734
How about putting all your encrypted pages into an sslfolder and have Apache do a rewrite of http to https for anything in that folder. Does Windows IIS have something similar?
0
 

Author Comment

by:bemara57
ID: 18776770
I say that because I've tried to mess with the location in the code before (to switch back and forth from http and https) and IE7 didn't let the certificate fully pass. It was much more stricter than IE6 or Firefox.
0
 
LVL 5

Expert Comment

by:Oscurochu
ID: 18777204
im not sure what you mean exactly anymore...
0
 
LVL 10

Expert Comment

by:ClickCentric
ID: 18777377
Wait..you want to redirect people to another page to avoid putting unnecessary strain on your server?   You do realize that the redirection would be just as much or possibly even more strain since it would have to process 2 requests rather than one, yes?
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question