top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Help on RewriteMap + RewriteCond - partial match

+3 votes
297 views

I want RewriteCond to match only requests that start with a text from rewriteMap file.

I did this but it only works as an exactly match.
RewriteMap robots_page txt:/etc/robots_page.txt
RewriteCond ${robots_page:%{REQUEST_URI}|NOT_FOUND} !=NOT_FOUND
robots_page.txt contents:/rest-api/ -/rest-apiv2/ -/rest-apiv3/ -

For instance, I want to match requests like:/rest-api/customer/1/rest-api/invoice/2/rest-api/customer/list/rest-apiv2/invoice/98/rest-apiv3/invoice/list

posted Mar 13, 2015 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote

I use apache 2.4 on centos.

I want to protect the access to a page (/my_folder/secure) with a cookie (in my exemple the cookie name is : my_cookie_name)

I would like that some machine with IP 192.1.1.10 and 192.1.1.11 can access the server without the cookie. This two IP address don't need to have the cookie for access to /my_folder/secure)

And all other IP address are redirect to address https://my_register_site.com if they don't have the cookie.

How to write this ? Some example, and of course it does not work.

Session On 
RewriteEngine on 
RewriteCond %{HTTP_COOKIE} !my_cookie_name 
RewriteCond %{REMOTE_ADDR} !^192.1.1.10$ 
RewriteCond %{REMOTE_ADDR} !^192.1.1.11$ 
RewriteRule ^(.*)$ https://my_register_site.com [NC,L,R=301] 
+2 votes

On my fedora 16 box using httpd.x86_64 2.2.21-1.fc16, using SSL,

I tried:

 ...
 RewriteCond %{REMOTE_USER} ^mike$
 RewriteRule 
 ...

and variations thereof.

My intention is to have the RewriteRule run iff "mike" is logged on. It didn't work.

+1 vote

Will the rewrite module respect the order of the rules in the config file and execute the rules in order?

0 votes

Im trying to configure an Ubuntu server with 4 Public IPs to display "This is a shared IP site" if any of the IPs are accessed directly. The server has IP-based virtual-hosts configured on the different IPs. So far, Im not having any success with it.

+1 vote

Is it possible to configure Apache 2.4 to accept only one connection at time on port 443? is this something I can configure for my Virtual Hosts?

...