[英].htaccess https rewrite error redirection loop
我的.htaccess
代碼給我一個錯誤This webpage has a redirect loop
在chrome瀏覽器中This webpage has a redirect loop
。
誰能糾正我的.htaccess
代碼?
RewriteEngine On
RewriteCond %{HTTP_HOST} ^purchase\.com\.au$ [OR]
RewriteCond %{HTTP_HOST} ^www\.purchase\.com\.au$
RewriteRule ^(.*)$ "https\:\/\/purchase\.com\.au\/$1" [R=301,L]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
DirectoryIndex index.html index.php
如果我的網站地址是Purchase.com.au,並且我需要將其重定向到https://purchase.com.au
嘗試這個:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
基本上,它的工作是檢查https是否關閉(通過http發出請求-沒有https),並將每個請求重定向到https變體(相同的URL只是轉到https而不是http)
這可能對您有幫助!
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://purchase.com.au/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://purchase.com.au/$1 [L,R=301]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
DirectoryIndex index.html index.php
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.