How to redirect all pages except one specific

This is a discussion on How to redirect all pages except one specific within the Apache Web Server forums, part of the Web Server and Related Forums category; Please I need help on this (in httpd.conf under apache) . I woulk like to redirect all pages except one . ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-18-2006
Jack Salis
 
Posts: n/a
Default How to redirect all pages except one specific

Please I need help on this (in httpd.conf under apache) .
I woulk like to redirect all pages except one .
I have one domaine with two ports (80 for http and 443 for https).
One page in http is redirected to https with commande below:
Redirect /reversation.php https://www.mydomaine.com/reservation.php
And then in https , all pages should be redirected back to http except
reservation.php .
How can I do that ????????????????
I tried with examples below but didn't work

RedirectMatch ^[^reservation\.php]$ http://www.mydomaine.com/$1
or
RedirectMatch ^([^reservation\.php])$ http://www.mydomaine.com/$1


Thanks

  #2 (permalink)  
Old 08-19-2006
Rik
 
Posts: n/a
Default Re: How to redirect all pages except one specific

Jack Salis wrote:
> Please I need help on this (in httpd.conf under apache) .
> I woulk like to redirect all pages except one .
> I have one domaine with two ports (80 for http and 443 for https).
> One page in http is redirected to https with commande below:
> Redirect /reversation.php https://www.mydomaine.com/reservation.php
> And then in https , all pages should be redirected back to http

except
> reservation.php .
> How can I do that ????????????????
> I tried with examples below but didn't work
>
> RedirectMatch ^[^reservation\.php]$ http://www.mydomaine.com/$1
> or
> RedirectMatch ^([^reservation\.php])$ http://www.mydomaine.com/$1


The [] indicate a character class, not a literal. In this case:
^([^reservation\.php])$
means:
if the total requests consists of characters that are all not r,
e, s, v, a, t, i, o, n, ., p or h, then redirect. Idoubt this is a
scenario that will ever happen.


I've never tried this with HTTPS, but this might work. If you have
further rewriterules, put them below these ones:

RewriteCond %{SERVER_PROTOCOL} !^https$ [NC]
RewriteCond %{REQUEST_URI} ^/reservations\.php
RewriteRule ^.*$ https://example.com/$1 [R=301,L]

RewriteCond %{SERVER_PROTOCOL} ^https$ [NC]
RewriteCond %{REQUEST_URI} !^/reservations\.php
RewriteRule ^.*$ http://example.com/$1 [R=301,L]

--
Grtz,

Rik Wasmus


  #3 (permalink)  
Old 08-21-2006
Jack Salis
 
Posts: n/a
Default Re: How to redirect all pages except one specific

Rik wrote:

> Jack Salis wrote:
>> Please I need help on this (in httpd.conf under apache) .
>> I woulk like to redirect all pages except one .
>> I have one domaine with two ports (80 for http and 443 for https).
>> One page in http is redirected to https with commande below:
>> Redirect /reversation.php https://www.mydomaine.com/reservation.php
>> And then in https , all pages should be redirected back to http

> except
>> reservation.php .
>> How can I do that ????????????????
>> I tried with examples below but didn't work
>>
>> RedirectMatch ^[^reservation\.php]$ http://www.mydomaine.com/$1
>> or
>> RedirectMatch ^([^reservation\.php])$ http://www.mydomaine.com/$1

>
> The [] indicate a character class, not a literal. In this case:
> ^([^reservation\.php])$
> means:
> if the total requests consists of characters that are all not r,
> e, s, v, a, t, i, o, n, ., p or h, then redirect. Idoubt this is a
> scenario that will ever happen.
>
>
> I've never tried this with HTTPS, but this might work. If you have
> further rewriterules, put them below these ones:
>
> RewriteCond %{SERVER_PROTOCOL} !^https$ [NC]
> RewriteCond %{REQUEST_URI} ^/reservations\.php
> RewriteRule ^.*$ https://example.com/$1 [R=301,L]
>
> RewriteCond %{SERVER_PROTOCOL} ^https$ [NC]
> RewriteCond %{REQUEST_URI} !^/reservations\.php
> RewriteRule ^.*$ http://example.com/$1 [R=301,L]
>


Thanks
It works .
I don't even need this line :
RewriteCond %{SERVER_PROTOCOL} !^https$ [NC]
nor
RewriteCond %{SERVER_PROTOCOL} ^https$ [NC]
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:45 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0