logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Negate Regexp in Rewrite
Author
vince789



Joined: 29 Mar 2011
Posts: 2
Location: Portland

PostPosted: Thu 27 Oct '11 18:40    Post subject: Negate Regexp in Rewrite Reply with quote

I am struggling with this Rewrite rule where I want to allow 2 uri's and block all with a Forbidden.
When I test the regex I get the results as expected but it does not work in httpd.conf. This is what I have

RewriteEngine On
RewriteCond %{SERVER_PORT} ^8080$
RewriteRule MyApp/index\.php http://example:10080/MyApp/Login.do [R=301,L]

#Block any uri that is not index.php or Login.do
RewriteEngine On
RewriteCond %{SERVER_PORT} ^8080$
RewriteRule MyApp/(?!index.php)|MyApp/(?!Login.do) - [F]

The first rule works fine but when I add the second rule I get Forbidden.
Back to top
Kanashii



Joined: 17 Jul 2006
Posts: 155
Location: Porando

PostPosted: Tue 01 Nov '11 5:58    Post subject: Reply with quote

switch [F] is FORBIDDEN ?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 01 Nov '11 7:51    Post subject: Reply with quote

Kanashii wrote:
switch [F] is FORBIDDEN ?


Yepp it is. His question is.
Code:

IF NOT URL A OR URL B THAN ERROR 403.

So how to implement the NOT.
Back to top


Reply to topic   Topic: Negate Regexp in Rewrite View previous topic :: View next topic
Post new topic   Forum Index -> Apache