On Wed, Aug 14, 2019 at 5:18 PM Simon Funnell <simonfunn...@gmail.com> wrote: > > On Tue, 6 Aug 2019 at 14:33, John Larsen <john.lar...@javapipe.com> wrote: > > > I usually handle the redirect on the webserver side and set the alias in > > server.xml to the subdomain. > > > > John Larsen > > > > > > > I have now successfully loaded the rewrite valve in the application > context.xml but I am getting the following error on start up: > java.util.regex.PatternSyntaxException > > This is the rewrite.config file: > > RewriteCond %{HTTP_HOST} !^(.*)\.domain\.org\ [NC] > RewriteRule ^(.*)$ https://www.domain.org/$1 [R=301,L] > > It looks like the first line is an error and I don't know enough about > regex to fix it. > > Any help is great thanks. > >
The \ after .org is misplaced (it's trying to quote the space following it), remove that and try again Chris Chris > > > > > On Tue, Aug 6, 2019 at 7:11 AM Simon Funnell <simonfunn...@gmail.com> > > wrote: > > > > > Hi, > > > > > > I was going to do a redirect at my dns provider from the naked domain to > > > the www subdomain. Unfortunatly this doesn't really work if it is over > > > https so I am going to have to do the redirect at the host level. My > > > question is, is this what the rewrite valve is for? I was going to set up > > > two hosts, one for the naked domain and one for the subdomain with a set > > up > > > like the following: > > > > > > <Host name="domain.org" appBase="webapps2" > > > unpackWARs="true" autoDeploy="true"> > > > <!-- Insert rewrite valve here --> > > > </Host> > > > > > > <Host name="www.domain.org" appBase="webapps" > > > unpackWARs="true" autoDeploy="true"> > > > > > > <!-- Access log processes all example. > > > Documentation at: /docs/config/valve.html > > > Note: The pattern used is equivalent to using > > pattern="common" > > > --> > > > <Valve className="org.apache.catalina.valves.AccessLogValve" > > > directory="logs" > > > prefix="localhost_access_log" suffix=".txt" > > > pattern="%h %l %u %t "%r" %s %b" /> > > > > > > </Host> > > > > > > If this is what the rewrite valve is for, how do I configure it to > > redirect > > > to the subdomain apart from when it accesses the .well-known folder > > (which > > > is needed to get a letsencrypt certificate). > > > > > > If the rewrite valve is not the correct way to do this do I just deploy a > > > catch all servlet or a filter to do the redirect instead? > > > > > > Thanks, > > > > > > Simon > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org