【发布时间】:2018-04-21 23:18:51
【问题描述】:
所以无论有没有路径,我都想将 example.com/* 重定向到 http://example.com/*
我听说拥有静态 URL 对 SEO 有好处,例如,如果访问者导航到 www.example.com/path 或只是 example.com/path,我会将他们重定向到 http://example.com/path
提前致谢。
【问题讨论】:
所以无论有没有路径,我都想将 example.com/* 重定向到 http://example.com/*
我听说拥有静态 URL 对 SEO 有好处,例如,如果访问者导航到 www.example.com/path 或只是 example.com/path,我会将他们重定向到 http://example.com/path
提前致谢。
【问题讨论】:
我想这会对你有所帮助
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.+)$
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
【讨论】: