Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intelligencia URLRewriter HTTP to HTTPS

I am trying to get URLRewriter to force redirect a HTTP requests to a HTTPS. The vendors documentation doesn't seem to cover it.

I know the following parameters throws an error but serve to illustrate what I am trying to accomplish:

<rewriter>
    <if url="http://www.domain.com/test*">
       <rewrite url="http://www.domain.com/test*" to="https://www.domain.com/test*" />
    </if>
</rewriter>
like image 884
glin Avatar asked Dec 05 '25 05:12

glin


2 Answers

It would be useful to know exactly what error is thrown to make sure I am heading down the right path here but I think you are using the * character when you mean to use the . character (possibly .+ if you are intending any non secure URL to be redirected to the secure version)

like image 82
Richard Barrett Avatar answered Dec 10 '25 00:12

Richard Barrett


It seems like what the original poster wanted to do was something like:

<rewriter>
    <if url="http://.*">
       <rewrite url="http://([^/]*)(.*)" to="https://$1$2" />
    </if>
</rewriter>

However, that doesn't seem to work at all - I'm not really sure what it's doing under the hood to understand why. The regexes seem to be sound. I found this site really helpful for figuring some of this out: http://regexhero.net/tester/

I finally found the magic incantation to make it work, from:

https://webmasters.stackexchange.com/a/31318

<rewriter>
    <if header="HTTPS" match="^OFF$">
        <redirect url="(.*)" to="https://yourdomain.com$1"/>
    </if>
</rewriter>
like image 25
imjosh Avatar answered Dec 10 '25 00:12

imjosh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!