Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: Negate Regexp in Rewrite |
|
Author |
|
vince789
Joined: 29 Mar 2011 Posts: 2 Location: Portland
|
Posted: Thu 27 Oct '11 18:40 Post subject: Negate Regexp in Rewrite |
|
|
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
|
Posted: Tue 01 Nov '11 5:58 Post subject: |
|
|
switch [F] is FORBIDDEN ? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 01 Nov '11 7:51 Post subject: |
|
|
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 |
|
|
|
|
|
|