1

I have tried to use the example from this wiki page -

$HTTP["scheme"] == "http" { # capture vhost name with regex conditiona -> %0 in redirect pattern # must be the most inner block to the redirect rule $HTTP["host"] =~ ".*" { url.redirect = (".*" => "https://%0$0") } } 

But when I enter this url -

http://www.domain.co.il/index.php?shop=amazon 

I got redirected to

https://index.php/index.php?shop=amazon 

What is the problem?

1
  • The example on the wiki page is fine; the question is how you tried to use it - maybe show us a larger part of your config. Commented Sep 14, 2014 at 18:12

2 Answers 2

0

Everything works fine after removing this -

url.rewrite-once = ( "^/min/([a-z]=.*)" => "/min/index.php?$1", "^(.*)\.(jpg|gif|woff|tff|png|js|css|html|htm|txt)(.*)$" => "$0", "^/question2answer/(.+)$" => "/question2answer/index.php?qa-rewrite=$1", "^/$" => "/index.php" ) 
1
  • But is there a way to do so with addition redirecting to "www." if there is no "www." in host? May be I need to ask a new question? Commented Sep 14, 2014 at 18:30
-1

This might not be the most elegant way, but it worked for us. Explicitly catches a regex match. (Note: maybe it should be "https://%1$1")

$SERVER["socket"] == ":80" { $HTTP["host"] =~ "^(.*)$" { url.redirect = ( "^/(.*)" => "https://%1/$1" ) } } 
1
  • .* matches by default the complete string (greedy match), and so %0 and $0 are perfectly fine. $SERVER also adds a socket bind, which usually isn't wanted - the scheme matching is the right way. Commented Sep 14, 2014 at 18:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.