[英].htacces redirect from example.com/abc to https://www.example.com/abc
htaccess: 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]
Above code I'm using in my .htaccess
and Now I want to redirect when someone type example.com/abc
to https://www.example.com/abc
. 以上我在
.htaccess
使用的代码,现在当有人将example.com/abc
键入https://www.example.com/abc
时,我想重定向。
By using the above code when I goto example.com/abc
its showing 404
error. 通过使用上面的代码,当我转到
example.com/abc
它显示404
错误。
So please someone help me to solve this. 所以请有人帮我解决这个问题。 Answers are appreciated.
答案表示赞赏。
You can use: 您可以使用:
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.