[英]redirect http to https but show index.php?cmd=
我使用此代碼將我的網站從http重定向到https。 這行得通
RewriteCond %{HTTPS} =off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]
但是當我刷新時,我的網址更改為:
https://example.com/index.php?cmd=
這是我的.htacess
Options +FollowSymLinks
Options -Indexes
ErrorDocument 404 error/404
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?cmd=$1 [L,NC,QSA]
RewriteCond %{HTTPS} =off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]
我該如何解決。 謝謝
(對不起,我無法添加標簽.htacess,所以我選擇了php標簽)
這條規則:
RewriteRule ^(.*)$ index.php?cmd=$1 [L,NC,QSA]
匹配所有字符串:
^
表示網址的開頭 $
表示結束。 .
匹配任何字符,並且*
會重復多次(包括0)。 (.*)
將不捕獲任何內容。 $1
被捕獲。 由於刷新了主機的根目錄,因此一無所獲,您什么也看不到。 無論如何,如果不需要所有內容作為命令重定向,請刪除該行並重新啟動Apache服務器。 例如
YourWebsite.com/coolStuff
通過該行重定向到
YourWebsite.com/index.php?cmd=coolStuff
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.