我需要你的帮助。 假设这是我的网站:example.com.htaccess带URL重写的SSL重定向
我想将http重定向到https。 此外,我还想重写网址。 如果我访问网站:
https://example.com/new
一切工作正常。
如果我访问该网站: http://www.example.com/new
它重定向到https,但不会重写URL。结果是这样的:
`https://example.com/old`
RewriteEngine on
RewriteRule ^new/(.*)$ old/$1 [L,QSA]
RewriteCond %{HTTPS} =off [NC,OR]
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301,NC]
我试图把规则以另一种顺序,但这根本不工作。
我希望你能帮助我。非常感谢:)
切换您的规则的顺序。 – hjpotter92