httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MOKRANI Rachid <>
Subject [users@httpd] cookie and RewriteCond
Date Wed, 06 May 2015 12:16:09 GMT

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 and 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 if they don't
have the cookie.

How to write this ?

Some exemple, and of course it does not work.

Thanks in advance for any suggestions.

        <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 ^(.*)$ [NC,L,R=301]

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.
View raw message