Ramaraj
Ramaraj

Reputation: 146

how to redirect domian.com to www.domain.com in jboss 7.1.1 server

In my website i get ssl for www.domain.com. i open using this its worked fine, when i use domain.com it show security exception how to resolve that

i used url rewrite in my standalone.xml file like below but it not worked for me

<virtual-server name="default-host" enable-welcome-root="false">
    <alias name="domain.com"/>
    <alias name="www.domain.com"/>
    <rewrite pattern="^(.*)$" substitution="https://$1" flags="R=301,L">
        <condition test="%{HTTP_HOST}" pattern="^www\.(.+)$" flags="NC"/>
    </rewrite>
</virtual-server>

please let me know if i did anything wrong?

Upvotes: 1

Views: 542

Answers (1)

Ramaraj
Ramaraj

Reputation: 146

its worked fine after this changes

<rewrite pattern="^(.*)$" substitution="https://www.domain.com$1" flags="R=301,L">
                <condition test="%{HTTP_HOST}" pattern="!^www\.domain\.com$" flags="NC"/>
            </rewrite>

Upvotes: 1

Related Questions