簡體   English   中英

問題寬度htaccess重定向到https

[英]issues width htaccess redirect to https

我正在嘗試通過.htaccess將http重定向到https,但在某些地方不起作用!

這是我的域名:www.amirforsati.ir

當我使用像http://www.amirforsati.ir這樣的http時,它將重定向到https

當我使用http://www.amirforsati.ir/want之類的http時,它不會重定向到https

我的apache.htacces代碼是:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^amirforsati\.ir [NC]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://www.amirforsati.ir/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^136\.243\.80\.209
RewriteRule (.*) https://www.amirforsati.ir/$1 [R=301,L]

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* ? [F,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

您可以嘗試以下方法:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^want.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

來源: https : //stackoverflow.com/a/13000059/3933634 (反)

要將所有請求重定向到https,請使用以下規則:

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM