You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by CWSSupport - Marcello Lorenzi <ml...@sorint.it> on 2014/02/22 10:10:46 UTC

[users@httpd] R: RE: [users@httpd] Rewrite all to DocRoot

Hi Darren,
You can try to implement it with rewrite rules or rewrite map.

Did you already try with mod_rewrite?
-----Original Message-----
From: "Darren Ward (darrward)" <da...@cisco.com>
Date: Sat, 22 Feb 2014 08:33:21 
To: users@httpd.apache.org<us...@httpd.apache.org>
Reply-to: users@httpd.apache.org
Subject: RE: [users@httpd] Rewrite all to DocRoot

Hi Guys

I'm still struggling with the AliasMatch

I need to redirect everything that doesn't match a couple of specific requests to the root index.html of the virtual server but I can't find any examples on using conditional statements

For example I have:

    AliasMatch /perl/(.*)$ /var/www/perl/$1
    AliasMatch /success.html$ /www/docs/wifi-tc/library/test/success.html
    AliasMatch ^(.*)$ /www/docs/wifi-tc/index.html

So that the first rule would use a central perl directory but keep the script name from the original request

Second rule is to redirect and Apple device attempting to perform captive portal detection to a success page so the device will bring up a normal browser

The final one is to redirect everything  _esle_ to the index.html file specified

Problem is I think it will also hit matches to the first two rules as it flows through or will it hot a match and stop processing?

Darren

-----Original Message-----

> On each of these virtual hosts I want a request for any URI to be sent to the document root default (/index.html or just /)
>
> What the best way to do this per virtual host?

I usually use:

AliasMatch ^(.*)$ /fspath/to/index.html



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


Re: [users@httpd] R: RE: [users@httpd] Rewrite all to DocRoot

Posted by Didier Spaier <di...@epsm.fr>.
On 22/02/2014 10:10, CWSSupport - Marcello Lorenzi wrote:
> Hi Darren,
> You can try to implement it with rewrite rules or rewrite map.
>
> Did you already try with mod_rewrite?

And you can use [S] and/or [L] (and/or [END] in Apache 2.4) flags of RewriteRule to implement conditional jumps.

See http://httpd.apache.org/docs/2.4/en/rewrite/flags.html

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


Re: [users@httpd] R: RE: [users@httpd] Rewrite all to DocRoot

Posted by Marcello Lorenzi <ml...@sorint.it>.
Hi Darren,
I don't know your specific configuration but an ideal part of configuration can be this:
  
     DocumentRoot /www/docs/wifi-tc/

     Alias/perl  /var/www/perl
     Alias /success.html /www/docs/wifi-tc/library/test/success.html

     RewriteEngine On
     RewriteCond %{REQUEST_URI} !^/perl/.*$
     RewriteCond %{REQUEST_URI} !^/success\.html$
     RewriteRule ^(.*)$ /index.html [R=301,L]

I think that mod_rewrite move all the pages not specified or matched with the previous Alias lines.

Marcello

On 02/22/2014 10:26 AM, Darren Ward (darrward) wrote:
> Ciao Marcello
>
> No I haven't
>
> I'm coming back to Apache after a very long absence and starting from scratch so I'd be happy to get guidance on better ways to achieve the results I need
>
> I don't want to change the URL if possible but results are what counts :)
>
> Darren
>
> Sent from my iPad
>
>> On 22 Feb 2014, at 8:06 pm, "CWSSupport - Marcello Lorenzi" <ml...@sorint.it> wrote:
>>
>> Hi Darren,
>> You can try to implement it with rewrite rules or rewrite map.
>>
>> Did you already try with mod_rewrite?
>> -----Original Message-----
>> From: "Darren Ward (darrward)" <da...@cisco.com>
>> Date: Sat, 22 Feb 2014 08:33:21
>> To: users@httpd.apache.org<us...@httpd.apache.org>
>> Reply-to: users@httpd.apache.org
>> Subject: RE: [users@httpd] Rewrite all to DocRoot
>>
>> Hi Guys
>>
>> I'm still struggling with the AliasMatch
>>
>> I need to redirect everything that doesn't match a couple of specific requests to the root index.html of the virtual server but I can't find any examples on using conditional statements
>>
>> For example I have:
>>
>>     AliasMatch /perl/(.*)$ /var/www/perl/$1
>>     AliasMatch /success.html$ /www/docs/wifi-tc/library/test/success.html
>>     AliasMatch ^(.*)$ /www/docs/wifi-tc/index.html
>>
>> So that the first rule would use a central perl directory but keep the script name from the original request
>>
>> Second rule is to redirect and Apple device attempting to perform captive portal detection to a success page so the device will bring up a normal browser
>>
>> The final one is to redirect everything  _esle_ to the index.html file specified
>>
>> Problem is I think it will also hit matches to the first two rules as it flows through or will it hot a match and stop processing?
>>
>> Darren
>>
>> -----Original Message-----
>>
>>> On each of these virtual hosts I want a request for any URI to be sent to the document root default (/index.html or just /)
>>>
>>> What the best way to do this per virtual host?
>> I usually use:
>>
>> AliasMatch ^(.*)$ /fspath/to/index.html
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>> B‹KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB•È[œÝXœØÜšX™KK[XZ[ˆ\Ù\œË][œÝXœØÜšX™P˜\XÚK›Ü™ÃB‘›ÜˆY][Û˜[ÛÛ[X[™ËK[XZ[ˆ\Ù\œËZ[˜\XÚK›Ü™ÃB


Re: [users@httpd] R: RE: [users@httpd] Rewrite all to DocRoot

Posted by "Darren Ward (darrward)" <da...@cisco.com>.
Ciao Marcello

No I haven't 

I'm coming back to Apache after a very long absence and starting from scratch so I'd be happy to get guidance on better ways to achieve the results I need

I don't want to change the URL if possible but results are what counts :)

Darren

Sent from my iPad

> On 22 Feb 2014, at 8:06 pm, "CWSSupport - Marcello Lorenzi" <ml...@sorint.it> wrote:
> 
> Hi Darren,
> You can try to implement it with rewrite rules or rewrite map.
> 
> Did you already try with mod_rewrite?
> -----Original Message-----
> From: "Darren Ward (darrward)" <da...@cisco.com>
> Date: Sat, 22 Feb 2014 08:33:21 
> To: users@httpd.apache.org<us...@httpd.apache.org>
> Reply-to: users@httpd.apache.org
> Subject: RE: [users@httpd] Rewrite all to DocRoot
> 
> Hi Guys
> 
> I'm still struggling with the AliasMatch
> 
> I need to redirect everything that doesn't match a couple of specific requests to the root index.html of the virtual server but I can't find any examples on using conditional statements
> 
> For example I have:
> 
>    AliasMatch /perl/(.*)$ /var/www/perl/$1
>    AliasMatch /success.html$ /www/docs/wifi-tc/library/test/success.html
>    AliasMatch ^(.*)$ /www/docs/wifi-tc/index.html
> 
> So that the first rule would use a central perl directory but keep the script name from the original request
> 
> Second rule is to redirect and Apple device attempting to perform captive portal detection to a success page so the device will bring up a normal browser
> 
> The final one is to redirect everything  _esle_ to the index.html file specified
> 
> Problem is I think it will also hit matches to the first two rules as it flows through or will it hot a match and stop processing?
> 
> Darren
> 
> -----Original Message-----
> 
>> On each of these virtual hosts I want a request for any URI to be sent to the document root default (/index.html or just /)
>> 
>> What the best way to do this per virtual host?
> 
> I usually use:
> 
> AliasMatch ^(.*)$ /fspath/to/index.html
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> B‹KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB•È[œÝXœØÜšX™KK[XZ[ˆ\Ù\œË][œÝXœØÜšX™P˜\XÚK›Ü™ÃB‘›ÜˆY][Û˜[ÛÛ[X[™ËK[XZ[ˆ\Ù\œËZ[˜\XÚK›Ü™ÃB

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