Apache htaccess将所有流量从http重定向到https,但也重定向到index.php,该index.php在https上隐藏一次

Apache htaccess将所有流量从http重定向到https,但也重定向到index.php,该index.php在https上隐藏一次,apache,.htaccess,http,redirect,https,Apache,.htaccess,Http,Redirect,Https,我正在寻找一个.htaccess文件,它可以执行以下操作,我已经设法使每个函数单独工作,但不能一起工作 第一项规定: 所有HTTP通信都重定向到HTTPS 第2项要求: 所有HTTPS url都指向index.php?url_参数= 我要么在请求_uri上结束一个无休止的循环,要么结束服务器错误: Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTPS} off #RewriteCond %{HTTP:X-Forwarded-P

我正在寻找一个.htaccess文件,它可以执行以下操作,我已经设法使每个函数单独工作,但不能一起工作

第一项规定: 所有HTTP通信都重定向到HTTPS

第2项要求: 所有HTTPS url都指向index.php?url_参数=

我要么在请求_uri上结束一个无休止的循环,要么结束服务器错误:

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{HTTPS} off
#RewriteCond %{HTTP:X-Forwarded-Proto} = http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ ./index.php?url_path=$1 [L,NC,QSA]
因此,如果有人要键入“”,它将重定向到“”,然后“”将被发送到index.php,page1将作为url参数发送

谢谢

试试这些规则:

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url_path=$1 [L,QSA]

在测试此更改之前,请清除浏览器缓存。

您的Apache版本是什么?您是否支持某个代理或cloudfare?结果:此网页有一个重定向循环ERR\u过多\u REDIRECTSChange
RewriteCond%{HTTPS}off
RewriteCond%{HTTP:X-Forwarded-Proto}!https
并重新测试