我一直在寻找一种强制https和非www的方法。在.htaccess
的一组代码中,没有重定向循环。
例如:
example.com = https://example.com
基本上,用户输入的任何内容都会转到 https://example.com
.
我将如何做到这一点?
这将处理您特定域的所有组合并重定向到https://example.com
RewriteEngine On
RewriteCond %{HTTPS} !^on [OR]
RewriteCond %{HTTP_HOST} ^www'. [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]