使用HTTPS将URL更改为URL [英] Change the URL to URL with HTTPS

查看:142
本文介绍了使用HTTPS将URL更改为URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器上有 .htacces ,它看起来像这样:

I have my .htacces on my server and it looks like so:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

但是当我在浏览器中输入 example.com 时它不会重定向到 https://example.com 。我怎么能这样做?

But when I type example.com in my browser it doesn't redirect to https://example.com. How can I do that?

推荐答案

看起来它只是 .htaccess的拼写(filename)这就是问题所在。这有两个 s ,而不是一个,如问题中所述。

It would seem it was just the spelling of .htaccess (filename) that was the problem. This has two s, not one, as stated in the question.

一点一点......可以在服务器配置中更改此文件的名称(每个目录的Apache配置文件名)(尽管这种情况很少见):

Bit of an aside... the name of this file (per-directory Apache config filename) can be changed in the server config (although this is rare):

AccessFileName .htaccess

这篇关于使用HTTPS将URL更改为URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆