> Date: Thu, Aug 23, 2007 at 12:20:31AM -0700
> Subject: [Resin-interest] How do you rewrite the server name in 3.0.24
>
> Hi,
> 
> I need to redirect URLs that contain host name aliases to our Web server 
> host name.  I see the resin.conf directive:
> 
> <rewrite-dispatch>
>    <moved-permanently regexp='^/foo' target='/bar'/>
> </rewrite-dispatch>

If you have one main site (for example www.hogwarts.com), and you want
every other site to be redirected to it, then you can do this:

    <host id="www.hogwarts.com">
      .... webapps etc for the real site ....
    </host>

    <!-- default host redirects all other sites to www.hogwarts.com -->
   <host id="" root-directory="hosts/rewrite">
      <web-app id="/">
        <rewrite-dispatch>
          <moved-permanently regexp="^/(secure.*)" 
target="https://www.hogwarts.com/$1"/>
          <moved-permanently regexp="^/" target="http://www.hogwarts.com/"/>
        </rewrite-dispatch>
      </web-app>
    </host>

If you only want to redirect some specific sites to www.hogwarts.com, then you
can do something like this:

    <host id="www.hogwarts.com">
      .... webapps etc for the hogwarts site ....
    </host>

    <!-- rewrite host redirects all host-alias sites to www.hogwarts.com -->
    <host id="rewrite" root-directory="hosts/rewrite">
      <host-alias>gryffindor.com</host-alias>
      <host-alias>www.gryffindor.com</host-alias>
      <host-alias>slytherin.com</host-alias>
      <host-alias>www.slytherin.com</host-alias>

      <web-app id="/">
        <rewrite-dispatch>
          <moved-permanently regexp="^/(secure.*)" 
target="https://www.hogwarts.com/$1"/>
          <moved-permanently regexp="^/" target="http://www.hogwarts.com/"/>
        </rewrite-dispatch>
      </web-app>
    </host>

The above configurations assume that all urls that begin with "/secure" should
be redirected to https://, and only urls that begin with "/secure" should be
redirected to https://.

-- Sam



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to