Re: RewriteCond
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Dan, On 5/30/15 12:13 PM, Daniel Mikusa wrote: On Sat, May 30, 2015 at 5:07 AM, Frank Lehmann frank-lehm...@freenet.de wrote: Hi Dan, First, please don't top post. -- Don't know what you mean, i am at qnalist.com and pushed the button reply to: This is top posting. http://en.wikipedia.org/wiki/Posting_style#Top-posting We prefer that people who write to the list use an inline style or bottom post. http://en.wikipedia.org/wiki/Posting_style#Interleaved_style or http://en.wikipedia.org/wiki/Posting_style#Bottom-posting The idea is that if everyone does the same thing, it's easier to read and follow conversations on the list. I don't know the website you're using, but you can subscribe your email here. I believe that's the preferred way to interact with the list. http://tomcat.apache.org/lists.html Reply inline like this or at the bottom. -- See above. Second, what is the mistake you're referring to? -- I explained, that the words, which are in the condpattern valvue do not match. Third, we don't know. -- I have this rewritecond set: RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|mobil e|palmos|webos) So, my opinion is, that any word of the string from the user-agent will match the string set in the third value of the rule. But it does not. nothing will happen. Have you tried something simpler first? Like the example I sent you. Does it work? From what you've posted, it's not clear if there's a Tomcat configuration problem (i.e. it's not starting the valve / reading the rules) or if the rule in question is not working as you'd expect. If it's the later, then you're going to need to adjust the rule to make it work. I haven't tried that rule, so I can't say if it will work or not. Plus, the regular expression doesn't do what he wants it to do; at least, I don't think it does. My guess is that there needn't be a double-quote symbol before android or after webos in the User-Agent string. You still haven't provided any configuration or explanation of what you did. Where did you configure the valve? In server.xml? In the Context for an app? Where did you put the rewrite.config file? -- My configuration is as follows: Windows 2012 R2 Tomcat 8.0 in directory tomcat/webapps Which version? There are currently 23 different releases of the 8.0 branch. server.xml in /conf directory with valve ...rewritevalve set. rewrite.config file in directory /conf/catalina/localhost Rewrite.config will controled after restart tomcat service, because if mistakes in the rule, tomcat won't start Sorry, not sure I follow you here. Are you saying that Tomcat is failing to start? If so, are you getting an error or exception? If so, include that here. I think he was saying that some proof that Tomcat is in fact reading the rewrite configuration file is that, when the file has an error in it, Tomcat will throw errors on startup. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v2 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJVa5qjAAoJEBzwKT+lPKRYzHIP/iH+s5Gd0JYBibQF7TkayuzD zte/Q5vWE+3cHroBtN3NBifQbqxm4qIIw5WocY/jcU396kCUwUNcWmji4hAVUgAv Ym7yAgeOJ9yUY6t3jM4+t13oFfjGCMHt8lqBcI29xOn7cL0kROdBjELoCB21RGUn Ng7Z3qeIbFHzNXTrGNlZlkkwvsJ4vzp6ErPBjtHUb/YJu+0CFGph352Ltar+Djq7 3m2tY6FCRfLECf/ur5KADWSTedRmdAiIWfreKt+PWR+weywI2aSxurBe7uuchdhw v0389BbhdqOqFlpYDIRtRLRS74NRm1JihQgOYaDFfMNO9Z67AnjQ3JGAd4KR29Fx +NL5ATMKKReFvalaPZVp5hTxVo1KfYPoW0G2hDyRFRFHju6/sqowyVnoBiARdZQB mVPWJ+7mXIEc8MREhVV5EWJD8XMdmiH2bBIWR2tmgZR2uvGQFHyFhHW8OxBwt0mD KORS+8eyxR0Fh/Uh5y2jplSgChuJVOFvRcuVy+iEquwzm9G9hx74g0Gl2iu3oGS8 VQznccNpNB767Ms53JBSXdbpqqM3YTc2LdDbzevNOIObWDefxJDp83wsl2eycQ/M kff4tTnuY5I3AzY5BL5wSUHs/9qOWdOQt9jtAvLf3DsbjODkP1fZsQHXYe6cxGV0 BMHvmBia/MxEAinEOLlI =B5SO -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RewriteCond
Hi Dan, First, please don't top post. -- Don't know what you mean, i am at qnalist.com and pushed the button reply to: Reply inline like this or at the bottom. -- See above. Second, what is the mistake you're referring to? -- I explained, that the words, which are in the condpattern valvue do not match. Third, we don't know. -- I have this rewritecond set: RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|mobile|palmos|webos) So, my opinion is, that any word of the string from the user-agent will match the string set in the third value of the rule. But it does not. nothing will happen. You still haven't provided any configuration or explanation of what you did. Where did you configure the valve? In server.xml? In the Context for an app? Where did you put the rewrite.config file? -- My configuration is as follows: Windows 2012 R2 Tomcat 8.0 in directory tomcat/webapps server.xml in /conf directory with valve ...rewritevalve set. rewrite.config file in directory /conf/catalina/localhost Rewrite.config will controled after restart tomcat service, because if mistakes in the rule, tomcat won't start Explained enough ? Regards Frank
Re: RewriteCond
On Sat, May 30, 2015 at 5:07 AM, Frank Lehmann frank-lehm...@freenet.de wrote: Hi Dan, First, please don't top post. -- Don't know what you mean, i am at qnalist.com and pushed the button reply to: This is top posting. http://en.wikipedia.org/wiki/Posting_style#Top-posting We prefer that people who write to the list use an inline style or bottom post. http://en.wikipedia.org/wiki/Posting_style#Interleaved_style or http://en.wikipedia.org/wiki/Posting_style#Bottom-posting The idea is that if everyone does the same thing, it's easier to read and follow conversations on the list. I don't know the website you're using, but you can subscribe your email here. I believe that's the preferred way to interact with the list. http://tomcat.apache.org/lists.html Reply inline like this or at the bottom. -- See above. Second, what is the mistake you're referring to? -- I explained, that the words, which are in the condpattern valvue do not match. Third, we don't know. -- I have this rewritecond set: RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|mobile|palmos|webos) So, my opinion is, that any word of the string from the user-agent will match the string set in the third value of the rule. But it does not. nothing will happen. Have you tried something simpler first? Like the example I sent you. Does it work? From what you've posted, it's not clear if there's a Tomcat configuration problem (i.e. it's not starting the valve / reading the rules) or if the rule in question is not working as you'd expect. If it's the later, then you're going to need to adjust the rule to make it work. I haven't tried that rule, so I can't say if it will work or not. You still haven't provided any configuration or explanation of what you did. Where did you configure the valve? In server.xml? In the Context for an app? Where did you put the rewrite.config file? -- My configuration is as follows: Windows 2012 R2 Tomcat 8.0 in directory tomcat/webapps Which version? There are currently 23 different releases of the 8.0 branch. server.xml in /conf directory with valve ...rewritevalve set. rewrite.config file in directory /conf/catalina/localhost Rewrite.config will controled after restart tomcat service, because if mistakes in the rule, tomcat won't start Sorry, not sure I follow you here. Are you saying that Tomcat is failing to start? If so, are you getting an error or exception? If so, include that here. Dan
Re: RewriteCond
On Tue, May 26, 2015 at 12:12 PM, Frank Lehmann frank-lehm...@freenet.de wrote: Hi Dan, First, please don't top post. Reply inline like this or at the bottom. you are right, i have used this documentation for setting the rewrite rule. This doc has is mistake in placing the rewrite.config file, but i solved it. Second, what is the mistake you're referring to? My problem is, that the test condition never works. Every test rule is ignored. So what is the reason why every test condition is ignored ? Third, we don't know. You still haven't provided any configuration or explanation of what you did. Where did you configure the valve? In server.xml? In the Context for an app? Where did you put the rewrite.config file? I did a quick test and it worked for me. 1.) I added this to the context for the examples app: `Valve className=org.apache.catalina.valves.rewrite.RewriteValve /` 2.) I added `webapps/examples/WEB-INF/rewrite.config` to the examples app. 3.) In that file, I put the following. ``` RewriteRule ^/junk$ /does-not-exist [R] ``` 4.) I started Tomcat and sent this request with curl. `curl -vv http://localhost:8080/examples/junk`. The response was a 302 redirect to http://localhost:8080/examples/does-not-exist;. Dan
Re: RewriteCond
On Mon, May 25, 2015 at 11:30 AM, Frank Lehmann frank-lehm...@freenet.de wrote: Hi helpers, i want to rewrite my url when a mobile user reaches my homepage. I found this condition on the web after several searchings. But it will not work. All other condition also not working, i have tested many conditions. How can i rewrite a url when a mobile client is getting my homepage ? Hassan mentioned one way, that's the UrlRewrite filter. Since you're on Tomcat 8, there's also a rewrite filter built-in. It uses a similar syntax to HTTPD, which is probably what you found posted on the internet. https://tomcat.apache.org/tomcat-8.0-doc/rewrite.html Thanks for help. RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|mobile|palmos|webos) [NC] RewriteRule ^(.+)$ http://www.dashandwerk.net/mobile/ [L] Where / how did you attempt to configure this? Dan My environment. Tomcat 8 Windows 2012 R2 Homepage under folder webapps/root - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RewriteCond
Hi Dan, you are right, i have used this documentation for setting the rewrite rule. This doc has is mistake in placing the rewrite.config file, but i solved it. My problem is, that the test condition never works. Every test rule is ignored. So what is the reason why every test condition is ignored ? Regards Frank - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteCond
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Frank, On 5/25/15 11:30 AM, Frank Lehmann wrote: i want to rewrite my url when a mobile user reaches my homepage. I found this condition on the web after several searchings. But it will not work. All other condition also not working, i have tested many conditions. How can i rewrite a url when a mobile client is getting my homepage ? Thanks for help. RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|mobile |palmos|webos) [NC] RewriteRule ^(.+)$ http://www.dashandwerk.net/mobile/ [L] Where did you put those directives? Your regular expression is probably not what you want, because it will require that android have a double-quote before it, and that webos have a double-quote after it. My environment. Tomcat 8 Windows 2012 R2 Homepage under folder webapps/root Note that webapps/root will require a request to http://www.dashandwerk.net/root/[whatever]. If you want to use the root context (deployed on /), you'll need to use ROOT (upper-case matters, even on a case-insensitive filesystem). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v2 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJVZHi8AAoJEBzwKT+lPKRYiawP/0zYgs1D/sPClbu3nGbR8OkD IWOj7CMeqPOitdATySIqImuLsq9xn+dWzgVKDXqL/DiGGcVFn8EpZB11Hp5bxj1q lYqFlA+Iaj/ZMoX5UcyJbmIi33fon8KdAuoaNx9LdQiIdbTVz9x8Q6JwRRNJKrrC QmXLXNdCQOBWGR8UGHPwhVPY2U5GEnuHpB1gmyqTgDsmqj3bZJx6YQIIhg50i7Ik 9EAum5PlrFwHq/FQJT5QORMgbwJcE1YPje/Vne/XSSOHfIWEqlPSIBL2FFkFh30g DE/vwhAO2fS5VBooAKaI/Mt47X9rHN5Q4F/DRwRDYqmcKpCEMk3sVJbL9JkKfsBd 84bWYwT4Q5Ip/3styIvYdhghYyy3H0FTtycDDc0RiK8FDiZD0kIdnRdoCOspsoTh o1hD+eGW2TOSNYnpDCx3lzaZv3z0nBNK4ZLokrdCeqWQp6x3XwsU9fiC19UIkUu9 dv+GXjfPQgx4KDfyxT8hh8tb98WNwthgEzR3W8BvSwWiYdE5M2iAOD75JDKjJkew xhEieVtZ7PP+KsofOvvwr0r/Apbqa0mpTAIPomhgYTzQD2SzxQ0qkFnDZvW8yBNx /0Tvr+AW8bIAwszbSRQxTEqTlQX9ktx7/LzUVijqwkP3IY64DOvRzfH9PQzrEIA0 ddt0DDDepc2Tt5GkkeFa =YJtJ -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: RewriteCond
On Mon, May 25, 2015 at 8:30 AM, Frank Lehmann frank-lehm...@freenet.de wrote: I found this condition on the web after several searchings. RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|mobile|palmos|webos) [NC] RewriteRule ^(.+)$ http://www.dashandwerk.net/mobile/ [L] But it will not work. Not surprising, since that's configuration for Apache httpd and has nothing to do with Tomcat. How can i rewrite a url when a mobile client is getting my homepage ? Assuming you are in fact actually using Tomcat, you can try this: http://tuckey.org/urlrewrite/ Good luck, -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder twitter: @hassan Consulting Availability : Silicon Valley or remote - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RewriteCond
Hi helpers, i want to rewrite my url when a mobile user reaches my homepage. I found this condition on the web after several searchings. But it will not work. All other condition also not working, i have tested many conditions. How can i rewrite a url when a mobile client is getting my homepage ? Thanks for help. RewriteCond %{HTTP_USER_AGENT} (android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|mobile|palmos|webos) [NC] RewriteRule ^(.+)$ http://www.dashandwerk.net/mobile/ [L] My environment. Tomcat 8 Windows 2012 R2 Homepage under folder webapps/root - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org