Thanks Igor

So in my example if I see a UserAgent starting with CaptiveNetworkSupport then 
I should rewrite the URL to http://originalhost/library/test/success.html

THEN the AliasMatch ending in /success.html should then map the request to the 
local file

Is that correct?

If so doesn't seem to be working as I can see UserAgent matching the 
RewriteCond in the logfile:

wifi-tc:192.168.104.39 - - [28/Feb/2014:11:02:42 +1100] "GET 
/ah66Mlma/GwaqQ1ka.html HTTP/1.0" 200 334 "-" "CaptiveNetworkSupport-277 wispr"
wifi-tc:192.168.104.39 - - [28/Feb/2014:11:15:08 +1100] "GET 
/NLHHvH2Y/Z4CXHCDW/Q9VhrIWd/x3O3upE2.html HTTP/1.0" 200 334 "-" 
"CaptiveNetworkSupport-277 wispr"

I added:

    RewriteLog logs/wifi-tc-rewrite

But it's always a zero length file with no hits (restarted Apache of course)

What's the best method to test a ReWrite and check debugs or logs?

Darren

--------------------------------------------------------------------------  

From: Igor Cicimov [mailto:icici...@gmail.com] 
Sent: Friday, 28 February 2014 6:55 PM
To: users
Subject: Re: [users@httpd] Mixing ReWrite and AliasMatch


On 27/02/2014 12:23 PM, "Darren Ward (darrward)" <darrw...@cisco.com> wrote:
>
> I then thought about putting the Rewrite at the bottom but when an AliasMatch 
> is met it doesn't continue searching I don't think so it would hit the 
> rewrite because of the last AliasMatch statement
>
Rewrite rewrites the url's and Alias maps url's to the file system. Hence 
apache will execute mod_rewrite before mod_alias no matter of the statement 
order.
> <VirtualHost 10.67.21.131>
>     DocumentRoot   /www/docs/wifi-tc
>
>     RewriteEngine   on
>     RewriteCond      %{HTTP_USER_AGENT}     ^CaptiveNetworkSupport*
>     RewriteRule      ^(.*)$      /library/test/success.html [L]
>
>     ScriptAlias        /cgi-bin/ "/www/docs/wifi-tc/cgi-bin/"
>
>     AliasMatch      /perl/(.*)$     /var/www/perl/$1
>     AliasMatch     /success.html$     
> /www/docs/wifi-tc/library/test/success.html
>     AliasMatch     ^(.*)$      /www/docs/wifi-tc/index.html
>
> </VirtualHost>
>
>
> Looking for some advise on how to rewrite this so that it would not change 
> the captive portal detect rewrite
>
> Darren
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>

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

Reply via email to