![](/img/trans.png)
[英]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.