【发布时间】:2011-08-08 08:13:16
【问题描述】:
我想用 www.example.org、https://www.example.org 和 http://example.org 将任何请求重写为 https://example.org
有简单的方法吗?
我目前在我的 .htaccess 中执行以下操作,但是 https://www.example.org -> https://example.org 的情况不起作用。
- 有什么想法可能会出错吗?
- 还会因为这种重定向而影响任何搜索引擎排名。
- 这是 URL 重定向的最佳实践吗?
我当前的 .htaccess 看起来像这样。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} example\.org
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://example.com%{REQUEST_URI}
</IfModule>
谢谢
【问题讨论】:
标签: .htaccess url-rewriting apache2 url-routing