.htaccess - 使用 .htaccess 文件的 HTTP 到 HTTPS 重定向不起作用
问题描述
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
ErrorDocument 404 https://whatmovieshouldiwatchtoday.com/error404.php
php_flag display_errors 1
RewriteEngine On
RewriteRule ^/?movie/([0-9A-Za-z-:-]+)/?$ /movie.php?id=$1 [NC,L]
RewriteEngine On
RewriteRule ^/?cast/([0-9A-Za-z-:-]+)/?$ /cast.php?cast=$1 [NC,L]
RewriteEngine On
RewriteRule ^/?keyword/([0-9A-Za-z-:-]+)/?$ /keyword.php?keyword=$1 [NC,L]
这是我的代码,现在这部分代码应该将 HTTP 重定向到 https,但它不起作用:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
当我尝试打开我的网站(即使使用 https)时,Google chrome 显示“Waiting For Whatmoviesshouldiwatchtoday.com”,几秒钟后,它显示
此页面不工作
whatmovieshouldiwatchtoday.com 将您重定向了太多次。
尝试清除您的 cookie。
ERR_TOO_MANY_REDIRECTS
解决方案
推荐阅读
- awk - 文件内列删除
- python - 根据另一个numpy数组值计算numpy数组
- python-3.x - 如何使用 Beautiful soup 抓取选举数据
- java - 用于电子邮件处理的同一表的 Java 并发查询
- getgauge - getgauge 无法启动仪表 API:连接到 127.0.0.1 超时
- javascript - 为每个随机对象选择器添加权重
- spring - 使用基本身份验证和 jwt 令牌保护 api
- java - 将变量从子 JSP 传递到父 JSP
- node.js - Firebase firestore - 在云功能中使用 collectionGroup 查询
- python - pymc3 模型在默认初始化的采样器中失败,但适用于“地图”