使用HTTPS而不是HTTP
我有一个用户必须登录的网站。我想使用HTTPS,所以建立一个到服务器的安全加密连接来检查用户名和密码。
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.
目前我的服务器上有一个名为httpdocs的文件夹,这是我的网站在哪里存储,我也有一个名为httpsdocs的文件夹。
Currently on my server i have a folder called httpdocs, this is where my website is store, i also have a folder called httpsdocs.
现在我说我的网站存储在httpdocs中,所以逻辑上我会去 http://website.com
Now as i stated my website is stored in httpdocs so logically i would go to http://website.com
但我发现如果我去 https://website.com 我可以安全地连接存储在httpdocs中的页面。
But i found that if i go to https://website.com i get a secure connect to the pages stored in httpdocs.
无论如何,我的问题是,无论何时我去另一个链接,我都会松开安全连接(URL会回到http://)那么我如何保证它的安全呢?我是否必须在href中使用完整的URL,因为这似乎有点蹩脚而不是仅使用href = page2.php。
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.
非常感谢帮助。
如果有人知道任何好事,一些基本教程或阅读材料会很棒吗?
Some basic tutorials or reading material would be awesome if anyone knows of anything good?
再次感谢。
要在评论中回答你的问题,你应该使用mod_rewrite(假设它已启用):
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]
会将任何网页发送到https。
that will send any webpage to https.