如何轻松创建HTTPS登录表单? [英] How to create a HTTPS login form easily?

查看:98
本文介绍了如何轻松创建HTTPS登录表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是网络编程的新手。我创建了一个简单的登录表单(使用php)。现在我想把这个变成HTTPS(带SSL)登录表单。我该怎么做才能实现这个目标?

I'm new to web programming. I've created a simple login form (with php). Now I want to turn this one into a HTTPS (with SSL) login form. What should I do to achieve this?

推荐答案

你需要启用SS L,如果它尚未启用
如果你要在生产中运行此功能,您还需要购买并且
安装SSL证书而不是自签名证书。

You will need to enable SSL, if it is not already enabled If you are going to run this in production, you will also need to purchase and install an SSL cert instead of a self-signed cert.

如果启用了SSL ,然后使用https而不是http运行您的表单,因为上面的注释表示将起作用

If SSL is enabled, then running your form with https instead of http as the comment above says will work

要强制用户使用SSL版本,请在.htaccess文件中添加以下内容

To force users to use the SSL version add something like the following to your .htaccess file

RewriteEngine On
Rewritebase /

RewriteCond %{HTTPS} off
RewriteRule ^login\.php https://yourdomain.com/login.php [L,R=301]

这篇关于如何轻松创建HTTPS登录表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆