Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using HTTPS instead of HTTP

Tags:

http

https

ssl

I have a website that user have to loggin to. I want to use HTTPS so make a secure encrypted connection to the server to check the user name and password.

Currently on my server i have a folder called httpdocs, this is where my website is store, i also have a folder called httpsdocs.

Now as i stated my website is stored in httpdocs so logically i would go to http://website.com

But i found that if i go to https://website.com i get a secure connect to the pages stored in httpdocs.

Anyway, my question is, whenever i go to another link i loose the secure connect (URL goes back to http://) So how do i keep it all secure? Would i have to use the full URL in the href because that seems a bit lame instead of just using href=page2.php .

I'm new this area of website developing, but i am experienced in developing if that helps you.

Thanks a bunch for the help.

Some basic tutorials or reading material would be awesome if anyone knows of anything good?

Thanks again.

like image 213
ragebunny Avatar asked May 29 '26 00:05

ragebunny


2 Answers

To answer your question in the comments you should use mod_rewrite (assuming its enabled):

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

that will send any webpage to https.

like image 173
Prisoner Avatar answered May 31 '26 18:05

Prisoner


Do not use http://foo.com/path in urls, use //foo.com/path instead (or, even better, if you stay on the same server, use /path - it surely works). Doing full urls is bringing redundancy and brittleness. Avoid it.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!