使用.htaccess到停放域的免费共享SSL证书重定向

时间:2015-08-23 15:51:08

标签: .htaccess redirect https ssl-certificate subdomain

您好我在我的网站上使用go位置并注意到警告消息:

getCurrentPosition()和watchPosition()在不安全的来源上已弃用,将来会删除支持。您应该考虑将应用程序切换到安全的来源,例如HTTPS。有关详细信息,请参阅http://i.imgur.com/YYKo37m.png

使用jushost,您将获得免费的共享ssl证书: https://goo.gl/rStTGz

所以我设置了这个我的链接是这样的 https://my.justhost.com/cgi/help/126。这是一个停放的域名。当用户输入http // office.xxxx / index.php我想要显示的问题 https // office.xxxx / index.php在地址中重定向到https://justxxx.justhost.com/~justxxx/office/index.php。不知道该怎么做。我认为它可以在.htaccess文件中完成,但我有点迷失。 任何帮助都会很棒 谢谢 乔恩

1 个答案:

答案 0 :(得分:-1)

这对你有用。阅读其中的评论。我无法完全理解你想要做什么,但如果你想将http重定向到https,这将有效。

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

EDIT1: 如果您只想重定向该特定网址。请参阅此问题:.htaccess https redirect for a single page (using relative urls)