On 05/06/2015 08:16 AM, MOKRANI Rachid wrote:
Hi,

I use apache 2.4 on centos.

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

I would like that somemachine with IP 192.1.1.10 and 192.1.1.11 can
access the server without the cookie. This two IP adress d’on’t need to
have the cookie for access to /my_folder/secure)

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

How to write this ?

Some exemple, and of course it does not work.


Can you elaborate on "does not work"? Enable the rewritelog and see what it thinks is happening.

See http://httpd.apache.org/docs/current/mod/mod_rewrite.html#logging for details on rewrite logging.




Thanks in advance for any suggestions.

Regards.

         <Directory /my_folder/secure >

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]

         </Directory>

__________________________

/Avant d'imprimer, pensez à l'environnement ! Please consider the
environment before printing ! /
/Ce message et toutes ses pièces jointes sont confidentiels et établis à
l'intention exclusive de ses destinataires. Toute utilisation non
conforme à sa destination, toute diffusion ou toute publication, totale
ou partielle, est interdite, sauf autorisation expresse. IFP Energies
nouvelles décline toute responsabilité au titre de ce message. This
message and any attachments are confidential and intended solely for the
addressees. Any unauthorised use or dissemination is prohibited. IFP
Energies nouvelles should not be liable for this message./
__________________________



--
Rich Bowen - rbo...@rcbowen.com - @rbowen
http://apachecon.com/ - @apachecon

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to