Solved

Redirect few (2) pages of website in https and other (3) pages in http mode.

Posted on 2013-11-30
7
413 Views
Last Modified: 2013-12-10
Hello,

I have a site consisting of  5 pages out of which there are 2 pages through which the site data gets registered in the database rest are simple pages.
what i need is to convert the  url of theses 2 pages to "https" as per the requirement rest theree pages should be in "http".

I have googled and came across the solution like below

window.location = window.location.href.replace(/^http:/, 'https:');


Is it the correct way to convert the pages to https?
Will the data be in encrypted form as it default functionality of https?
Will there be any certificate needs to be created for testing purpose?
0
Comment
Question by:Rocking
  • 3
  • 3
7 Comments
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 333 total points
ID: 39687213
To use HTTPS on the public internet, you must purchase and install an SSL/TLS certificate.  When you do that, any request starting with 'https://...' will negotiate a secure connection before it transfers any data.

You can also 'redirect' to the HTTPS connection in your programming language like PHP or in your .htaccess file on the server.
0
 

Author Comment

by:Rocking
ID: 39687232
It means this code will not work in https true sense

window.location = window.location.href.replace(/^http:/, 'https:');

I just need to test the web application.

http://xxx.xx.xx.xx/a.html
http://xxx.xx.xx.xx/b.html

now from b.html it goes to c.jsp which should open in
https://xxx.xx.xx.xx/c.jsp


What configuration i need to make so that i can test in my environment which is in tomcat
and jsp? It would be a great help if you can provide me some steps or url?
0
 
LVL 9

Accepted Solution

by:
QuinnDex earned 167 total points
ID: 39687240
to test or use on a private network you can create your own certificate see link below

http://www.akadia.com/services/ssh_test_certificate.html

as already mentioned you will need to buy a certificate to publish your site to the web, but these can be got for as little as £5 a year

best way to redirect to https is with a 301 redirect, do not use javascript as users with it turned off will not be redirected

use the rewrite mod below

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^YOURPAGE https://secure.example.com/YOURPAGE/ [R=301,L]

Open in new window

0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:Rocking
ID: 39687253
How to make configuration in tomcat for the below scenario

http://xxx.xx.xx.xx:8080/a.html
http://xxx.xx.xx.xx:8080/b.html

from b.html it goes to

https://xxx.xx.xx.xx:8080/c.jsp

and from this jsp after inserting data in db moves back to
http://xxx.xx.xx.xx:8080/a.html

flow is http -> https -> http

I am using jsp,java and apache tomcat.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39687266
You are correct,  'https' will not work without a certificate.  None of the rest matters since it is the certificate and the web server that enable the HTTPS mode.
0
 

Author Comment

by:Rocking
ID: 39687274
Thanks for the replies. Through the above help,I googled but everyone is talking about Apache Server.


All i need is to do some server configuration and create a self certificate for testing the scenario mentioned in my previous post.

I didn't came across any tomcat configuration for the above task.Since i am using standalone tomcat server,what configuration i need to make in it?
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 333 total points
ID: 39687399
Here's the man pages for Tomcat SSL: http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This video teaches users how to migrate an existing Wordpress website to a new domain.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now