Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > alt.apache.configuration > #4377

Re: 2 RewriteCond in AND mode

From "D. Stussy" <spam@spam.org>
Newsgroups alt.apache.configuration
Subject Re: 2 RewriteCond in AND mode
Date 2019-08-24 22:06 -0700
Message-ID <qjt50c$3sg$1@server.snarked.org> (permalink)
References <qj3sgs$t54$1@news.albasani.net>

Show all headers | View raw


"Gerome Muent"  wrote in message news:qj3sgs$t54$1@news.albasani.net...

Hi together,

I tried and failed to create a rule for:
Quoted message:
if the requested server is www.server1.com it should redirect to
www.server2.com unless the request url does not contain "prod/rest/"

I tried:

RewriteCond %{HTTP_HOST} !www.server2.com$ [NC]
RewriteCond !prod/REST/ [L]
RewriteRule ^(.*)$ https://www.server1.com/$1 [^] [L,R=301]

But it does not work.
Still redirects ALL requests to server2.

But it should not:
www.server1.com/prod/rest/appointsments f.e.

Thx for any help, Bernd
--------
If you want just the implied "index" file for the directory, and not other files, then you should terminate the regex  in 
RewriteCond with a "$".

Back to alt.apache.configuration | Previous | NextPrevious in thread | Find similar


Thread

2 RewriteCond in AND mode Gerome Muent <kontakt@bmservices.de> - 2019-08-15 17:08 +0200
  Re: 2 RewriteCond in AND mode "D. Stussy" <spam@spam.org> - 2019-08-24 22:06 -0700

csiph-web