Apache重定向到SSL而非www
我的WordPress网站上有两个域:xpemun.net
和example.com
,并希望将所有用户重定向到https://example.com
(使用SSL和www)。
链接示例:
http://example.com
http://www.example.com
http://example.net
http://www.example.net
https://example.com
https://www.example.com
https://example.net
https://www.example.net
我现在使用的表达式:
RewriteEngine On
RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
我尝试使用其他一些标准表达式,它们以某种方式起作用,但是这些解决方案和所有其他解决方案都有相同的问题。他们不会将链接重定向到https://example.com/category/
或https://example.com/category/sub-category/sub-category/
另一种链接为www.example.net/category/some.html
被重定向到example> example.com/category/some.html
。不了解问题在哪里。
I have two domains on my wordpress site: example.net
and example.com
and want to redirect all users to https://example.com
(with ssl and with out www).
Link examples:
http://example.com
http://www.example.com
http://example.net
http://www.example.net
https://example.com
https://www.example.com
https://example.net
https://www.example.net
Expression I use now:
RewriteEngine On
RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
I tried to use some other standard expressions and they work somehow but this and all other solutions have the same problem. They don't redirect links to https://example.com/category/
or https://example.com/category/sub-category/
Another links as www.example.net/category/some.html
are redirected to example.com/category/some.html
as they should. Can't understand where is the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论