Apache重定向问题以更改域名

Spo*_*pob 1 apache

我正在尝试向我的apache配置文件添加重写规则,以将用户重定向到新的URL.

我网站的网址是https://openmind.scribesoftware.com.如果用户使用https://openmind.scribesoft.com输入URL (请注意缺少"ware"),我想重定向它们,就好像他们输入了正确的URL一样.

我尝试了几种变体,例如:

RewriteEngine on
RewriteCond %{HTTPS_HOST} !^openmind\.scribesoft\.com$ [NC]
RewriteRule ^(.*)$ https://openmind.scribesoftware.com/$1 [R=301,L]
Run Code Online (Sandbox Code Playgroud)

但是,这会导致以下错误:

 This webpage has a redirect loop.

 The webpage at https://openmind.scribesoftware.com//enterprises/571 has resulted in too many redirects.
Run Code Online (Sandbox Code Playgroud)

我已经有一个重写规则,可以将非http请求重定向到https请求,并且工作正常.

谢谢.

Sim*_*onJ 6

HTTPS_HOST不是真正的变量(请参阅RewriteCond文档).使用HTTP_HOST和HTTPS:

...
RewriteCond %{HTTP_HOST} !^openmind\.scribesoftware\.com$ [NC]
RewriteCond %{HTTPS} =on
...
Run Code Online (Sandbox Code Playgroud)