Re: [users@httpd] redirect only if a URL does not exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Show us exactly what your best guess (based on the documentation) for
> the correct config is, and exactly what happens when you try it.
> 
> Joshua.
> 

Hi Joshua,

thanks for the hint with the loglevel. Now here's my httpd.conf :

ProxyRequests off
ProxyPass /sunreader/ http://localhost:8080/sunreader/
ProxyHTMLURLMap http://localhost:8080/sunreader/ /sunreader
ProxyHTMLLogVerbose On
LogLevel Debug


<Location /sunreader/>
	ProxyPassReverse /
	SetOutputFilter	 proxy-html
	ProxyHTMLURLMap	 /	/sunreader/
	ProxyHTMLURLMap	 /sunreader	/sunreader
	RequestHeader 	 unset	Accept-Encoding
</Location>

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteLog "C:\Programme\xampp\apache\logs\rewrite.log"
 RewriteLogLevel 100
 
 # Update
 RewriteCond 	%{REQUEST_URI} !-U
 RewriteRule    ^/(.*).do  http://localhost/Portal_Update.php [L]
 
 #RewriteCond   ^/conergy/(.*).do !-U
 #RewriteRule   ^/conergy/(.*).do  http://localhost/Portal_Update.php
 
 #RewriteCond   ^/suntechnics/(.*).do !-U
 #RewriteRule   ^/suntechnics/(.*).do  http://localhost/Portal_Update.php
 
 # Portal
 RewriteRule ^/conergy/(.*).do$ http://localhost/sunreader/$1.do?mandant=conergy [R,L]
 RewriteRule ^/suntechnics/(.*).do$ http://localhost/sunreader/$1.do?mandant=suntechnics [R,L]

 .....
 
</IfModule>

Note that I have mod_proxy enabled, because I want to redirect the requests with /sunreader/... to tomcat. But I tested it also with mod_jk with no difference. 
And here's the rewrite.log

[22/Aug/2006:17:39:10 +0200] /initial] (2) init rewrite engine with requested uri /conergy/Welcome.do
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/(.*).do' to uri '/conergy/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /subreq] (2) init rewrite engine with requested uri /conergy/Welcome.do
[22/Aug/2006:17:39:10 +0200] /subreq] (3) applying pattern '^/(.*).do' to uri '/conergy/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /subreq] (4) RewriteCond: input='/conergy/Welcome.do' pattern='!-U' => matched
[22/Aug/2006:17:39:10 +0200] /subreq] (2) rewrite '/conergy/Welcome.do' -> 'http://localhost/Portal_Update.php'
[22/Aug/2006:17:39:10 +0200] /subreq] (3) reduce http://localhost/Portal_Update.php -> /Portal_Update.php
[22/Aug/2006:17:39:10 +0200] /subreq] (2) local path result: /Portal_Update.php
[22/Aug/2006:17:39:10 +0200] /subreq] (2) prefixed with document_root to C:/Programme/xampp/htdocs/Portal_Update.php
[22/Aug/2006:17:39:10 +0200] /subreq] (1) go-ahead with C:/Programme/xampp/htdocs/Portal_Update.php [OK]
[22/Aug/2006:17:39:10 +0200] /initial] (5) RewriteCond URI (-U) check: path=/conergy/Welcome.do -> status=200
[22/Aug/2006:17:39:10 +0200] /initial] (4) RewriteCond: input='/conergy/Welcome.do' pattern='!-U' => not-matched
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/conergy/servlet/client.user.Login(.*)$' to uri '/conergy/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/suntechnics/servlet/client.user.Login(.*)$' to uri '/conergy/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/conergy/servlet/client.corp.Login(.*)$' to uri '/conergy/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/suntechnics/servlet/client.corp.Login(.*)$' to uri '/conergy/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/conergy/(.*).do$' to uri '/conergy/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (2) rewrite '/conergy/Welcome.do' -> 'http://localhost/sunreader/Welcome.do?mandant=conergy'
[22/Aug/2006:17:39:10 +0200] /initial] (3) split uri=http://localhost/sunreader/Welcome.do?mandant=conergy -> uri=http://localhost/sunreader/Welcome.do, args=mandant=conergy
[22/Aug/2006:17:39:10 +0200] /initial] (2) explicitly forcing redirect with http://localhost/sunreader/Welcome.do
[22/Aug/2006:17:39:10 +0200] /initial] (1) escaping http://localhost/sunreader/Welcome.do for redirect
[22/Aug/2006:17:39:10 +0200] /initial] (1) redirect to http://localhost/sunreader/Welcome.do?mandant=conergy [REDIRECT/302]
[22/Aug/2006:17:39:10 +0200] /initial] (2) init rewrite engine with requested uri /sunreader/Welcome.do
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/(.*).do' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /subreq] (2) init rewrite engine with requested uri /sunreader/Welcome.do
[22/Aug/2006:17:39:10 +0200] /subreq] (3) applying pattern '^/(.*).do' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /subreq] (4) RewriteCond: input='/sunreader/Welcome.do' pattern='!-U' => matched
[22/Aug/2006:17:39:10 +0200] /subreq] (2) rewrite '/sunreader/Welcome.do' -> 'http://localhost/Portal_Update.php'
[22/Aug/2006:17:39:10 +0200] /subreq] (3) reduce http://localhost/Portal_Update.php -> /Portal_Update.php
[22/Aug/2006:17:39:10 +0200] /subreq] (2) local path result: /Portal_Update.php
[22/Aug/2006:17:39:10 +0200] /subreq] (2) prefixed with document_root to C:/Programme/xampp/htdocs/Portal_Update.php
[22/Aug/2006:17:39:10 +0200] /subreq] (1) go-ahead with C:/Programme/xampp/htdocs/Portal_Update.php [OK]
[22/Aug/2006:17:39:10 +0200] /initial] (5) RewriteCond URI (-U) check: path=/sunreader/Welcome.do -> status=200
[22/Aug/2006:17:39:10 +0200] /initial] (4) RewriteCond: input='/sunreader/Welcome.do' pattern='!-U' => not-matched
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/conergy/servlet/client.user.Login(.*)$' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/suntechnics/servlet/client.user.Login(.*)$' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/conergy/servlet/client.corp.Login(.*)$' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/suntechnics/servlet/client.corp.Login(.*)$' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/conergy/(.*).do$' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/suntechnics/(.*).do$' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/voltwerk/(.*)$' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (3) applying pattern '^/suntechnics/admin/(.*)$' to uri '/sunreader/Welcome.do'
[22/Aug/2006:17:39:10 +0200] /initial] (1) pass through /sunreader/Welcome.do
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (2) init rewrite engine with requested uri /error/HTTP_SERVICE_UNAVAILABLE.html.var
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/(.*).do' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/conergy/servlet/client.user.Login(.*)$' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/suntechnics/servlet/client.user.Login(.*)$' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/conergy/servlet/client.corp.Login(.*)$' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/suntechnics/servlet/client.corp.Login(.*)$' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/conergy/(.*).do$' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/suntechnics/(.*).do$' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/voltwerk/(.*)$' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (3) applying pattern '^/suntechnics/admin/(.*)$' to uri '/error/HTTP_SERVICE_UNAVAILABLE.html.var'
[22/Aug/2006:17:39:13 +0200] /initial/redir#1] (1) pass through /error/HTTP_SERVICE_UNAVAILABLE.html.var
[22/Aug/2006:17:39:13 +0200] /subreq] (2) init rewrite engine with requested uri /error/include/top.html
[22/Aug/2006:17:39:13 +0200] /subreq] (3) applying pattern '^/(.*).do' to uri '/error/include/top.html'
[22/Aug/2006:17:39:13 +0200] /subreq] (3) applying pattern '^/suntechnics/admin/(.*)$' to uri '/error/include/top.html'
[22/Aug/2006:17:39:13 +0200] /subreq] (1) pass through /error/include/top.html
[22/Aug/2006:17:39:13 +0200] /subreq] (2) init rewrite engine with requested uri /error/include/bottom.html
[22/Aug/2006:17:39:13 +0200] /subreq] (3) applying pattern '^/(.*).do' to uri '/error/include/bottom.html'
[22/Aug/2006:17:39:13 +0200] /subreq] (3) applying pattern '^/suntechnics/admin/(.*)$' to uri '/error/include/bottom.html'
[22/Aug/2006:17:39:13 +0200] /subreq] (1) pass through /error/include/bottom.html
[22/Aug/2006:17:39:13 +0200] /subreq] (2) init rewrite engine with requested uri /error/contact.html.var
[22/Aug/2006:17:39:13 +0200] /subreq] (3) applying pattern '^/(.*).do' to uri '/error/contact.html.var'
[22/Aug/2006:17:39:13 +0200] /subreq] (3) applying pattern '^/suntechnics/admin/(.*)$' to uri '/error/contact.html.var'
[22/Aug/2006:17:39:13 +0200] /subreq] (1) pass through /error/contact.html.var

Until line 10 ( [22/Aug/2006:17:39:10 +0200] /subreq] (1) go-ahead with C:/Programme/xampp/htdocs/Portal_Update.php [OK] ) it looks fine to me.  But what makes me wonder that the Portal_Update.php site won't be displayed but instead of it only error 503. 
This is the URL I executed :
  http://localhost/conergy/Welcome.do

But only once. And because of the 'Portal' rule it is rewritten to this, what is only correct if the URL  is working :
   http://localhost/sunreader/Welcome.do?mandant=conergy

Thanks, Lothar

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux