tags:

views:

21

answers:

1

I am attempting to add a rewrite rule to my apache configuration file to redirect users to a new url.

The url of my site is https://openmind.scribesoftware.com. If a user enters a URL with https://openmind.scribesoft.com (note the lack of "ware") I'd like to redirect them as though they had typed the proper url.

I have tried a couple variations such as:

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

However that results in the following error:

 This webpage has a redirect loop.

 The webpage at https://openmind.scribesoftware.com//enterprises/571 has resulted in too many redirects.

I already have a rewrite rule to redirect non-http requests to https requests and that is working fine.

Thanks.

A: 

HTTPS_HOST is not a real variable (see the RewriteCond docs). Use HTTP_HOST and HTTPS:

...
RewriteCond %{HTTP_HOST} !^openmind\.scribesoft\.com$ [NC]
RewriteCond %{HTTPS} =on
...
SimonJ
Thanks for the quick response. Okay, my conf file now looks like:RewriteEngine onRewriteCond %{HTTP_HOST} !^openmind\.scribesoft\.com$ [NC]RewriteCond %{HTTPS} ="on"RewriteRule ^(.*)$ https://openmind.scribesoftware.com/$1 [R=301,L]It now works without any errors...but it's also not redirecting when I navigate to https://openmind.scribesoft.com.
Apologies - the quotes aren't needed. Edited (and actually tried it this time).
SimonJ