douhan4093 2012-04-10 14:26
浏览 71
已采纳

通过HTaccess强制SSL

Here are some questions I have about SSL.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} somefolder 
RewriteRule ^(.*)$ https://www.domain.com/somefolder/$1 [R,L]
  1. Above is code to force everything to go to SSL via HTAccess. Is there a way I can restrict this code to a specific IP Address. I want to force SSL for just my IP address so that I can test the site thoroughly using the new SSL links, and see (make sure) everything is working before taking it live to the live site. Testing with just my IP would be a lot easier.

  2. Is SSL going to interfere with any get/posts? Meaning...if I use that code above, and someone is on a page..and they submit a form, it's going to force them into SSL, is that going to be considered a redirect and clear out any post/get variables? I just want to try to find out ahead of time if it's going to mess up anything I have running.

  3. Have any of you had any situations where you forced SSL then had a lot of issues with the site not working right?

  • 写回答

2条回答 默认 最新

  • douzuan2814 2012-04-10 15:47
    关注

    If you want to make sure your site works well with HTTPS, turn off plain HTTP (assuming it's for whole server), or use Apache Httpd directives (in .htaccess or in the main configuration) that make the pages that need to be served over HTTPS return an error (e.g. 404) when they're accessed over plain HTTP. You could achieve this for a specific IP address by using Deny from xxxxxxx.

    Don't rely on mod_rewrite or similar to redirect plain HTTP requests to their HTTPS equivalent. This will at best hide problems and cause a false sense of security.

    The reason for this is that, even with a redirect, the initial requests are made in clear before being redirected: make sure all the references use https:// URIs before making use of them. You can find more details in this answer.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码