[英]Is it possible to redirect the example.com/index.php?page=abc to example.com/abc?
[英].htacces redirect from example.com/abc to https://www.example.com/abc
htaccess:
RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
以上我在.htaccess
使用的代碼,現在當有人將example.com/abc
鍵入https://www.example.com/abc
時,我想重定向。
通過使用上面的代碼,當我轉到example.com/abc
它顯示404
錯誤。
所以請有人幫我解決這個問題。 答案表示贊賞。
您可以使用:
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.