I'm trying to redirect all insecure HTTP requests on my site (e.g. http://www.example.com
) to HTTPS (https://www.example.com
). I'm using PHP btw. Can I do this in .htaccess?
相关问题
- Angular RxJS mergeMap types
- Backbone.js PushState routes .htaccess only workin
- “Zero out” sensitive String data in Swift
- Stop .htaccess redirect with query string
- Stop .htaccess redirect with query string
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- 请大神帮忙 post向https接口发送数据 部署到服务器为什么运行一会后就会报空指针
- How to get jQuery.ajax response status?
- send redirect and setting cookie, using laravel 5
- Warning : HTML 1300 Navigation occured?
- Is a unicode user agent legal inside an HTTP heade
- git: retry if http request failed
- Security concerns about CORS
To redirect all
http
requests tohttps
, you can use :If mod-rewrite isn't enabled and you are on apache 2.4, you can also use a
Redirect
insideif
directive to redirecthttp
requests tohttps
.Apache 2.4.
Add the following code to the .htaccess file:
Where [your domain name] is your website's domain name.
You can also redirect specific folders off of your domain name by replacing the last line of the code above with:
It works for me:
and for example, http://server/foo?email=someone%40example.com redirects normally without any issues. The file .htaccess located in the website root folder (for example named public_html). It is possible to use RewriteCond %{SERVER_PORT} !^443$ instead RewriteCond %{HTTPS} !on