WebFaction
Community site: login faq

I have two URLs pointing to the same application and I would like them all to be redirected to the SSL address with www (i.e https://www.example1.com)

I currently have the following in my http.conf file:

RewriteCond %{HTTP_HOST} ^example1.com [nc,or]
RewriteCond %{HTTP_HOST} ^www.example1.com [nc,or]  # Causes problems
RewriteCond %{HTTP_HOST} ^example2.com [nc,or]
RewriteCond %{HTTP_HOST} ^www.example2.com [nc]     # Causes problems
RewriteRule ^(.*) https://www.example1.com$1 [R=301,nc]

The conditions for www URLs don't seem to redirect properly and the browsers complain that the request will never complete.

Any help is greatly appreciated.

asked 21 Apr '12, 17:19

aa56280's gravatar image

aa56280
13214
accept rate: 0%


The rule that appears to be the issue is the second one,

RewriteCond %{HTTP_HOST} ^www.example1.com [nc,or]

Since it would point the URL to itself. Also are you using 2 applications, one for the re-directs another for the application itself, or just 1 with all the rules and the application?

If you use a seprate redirect application as outlined here it is easier to get it to work without infinite loops.

permanent link

answered 21 Apr '12, 17:41

johns's gravatar image

johns ♦♦
5.0k29
accept rate: 23%

I have one application but two different websites - one secure and one not.

As far as your point, yes, that is definitely the issue, but www.example1.com doesn't redirect to https://www.example1.com. How do I make that happen?

(21 Apr '12, 18:06) aa56280 aa56280's gravatar image

Did you try adding the second 'application' (not website) and putting the rule there? This should allow you to do this without the infinite loop. If you have any issues you may submit a support ticket and we will look at the account and assist you directly.

(21 Apr '12, 18:16) johns ♦♦ johns's gravatar image

I haven't. The solution you pointed to seem be addressing the second domain, which is fine, I'll give that a try for the other domain, but I also need to point www.example1.com to https://www.example1.com. What do I do with that?

(21 Apr '12, 18:19) aa56280 aa56280's gravatar image

This rule should do it,

RewriteCond %{HTTP:X-Forwarded-SSL} on
(21 Apr '12, 18:52) johns ♦♦ johns's gravatar image

Should I replace everything I mentioned earlier with that statement? If so, that's not doing anything from what I can tell.

(21 Apr '12, 19:06) aa56280 aa56280's gravatar image

So I created th static app for the second domain and that's working just fine. My other problem remains, redirecting example1.com and www.example1.com to https://www.example1.com

(21 Apr '12, 19:31) aa56280 aa56280's gravatar image

You should not replace everything with that rule, that is the rule that detects HTTPS It has a typo however since you don't want HTTPS try this one,

RewriteCond %{HTTP:X-Forwarded-SSL} !on
(21 Apr '12, 20:13) johns ♦♦ johns's gravatar image

That did it. Thanks.

(21 Apr '12, 22:14) aa56280 aa56280's gravatar image
showing 5 of 8 show 3 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×221
×27

question asked: 21 Apr '12, 17:19

question was seen: 1,704 times

last updated: 21 Apr '12, 22:14

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2017 PARAGON INTERNET GROUP LIMITED
WEBFACTION IS A SERVICE OF PARAGON INTERNET GROUP LIMITED
REGISTERED IN ENGLAND AND WALES 7573953 - VAT REGISTRATION NUMBER 182147021
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM