Forum Moderators: phranque

Message Too Old, No Replies

Not working RewriteRule / VirtualHost issue

Apache/1.3.29@OpenBSD; maybe config syntax error? : (

         

eriol

1:29 pm on Nov 3, 2011 (gmt 0)

10+ Year Member



Hello to all, can somebody please give me advice?
I have an Apache/1.3.29@OpenBSD httpd.conf configured and following VirtualHost and especially RewriteRule is not working (test.example.com goes to ProxyPass rule - see full config).
I guess its error in the config, but I was unable to identify it - with my current (not so big) knowledge - for several days now : (

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/
ServerName test.example.com
ServerAdmin admin@example.com
ErrorLog logs/error_test_log
TransferLog logs/access_test_log

<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteRule ^/(.*) [10.0.0.2:81...] [L,P]
RewriteRule ^/(.*) [whatever.com...] [L,P]
</IfModule>

CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>


I even tried the RewriteRule without "/" in regular expession, but no result there. Trying ProxyPass/ProxyPassReverse - no change either.
The whole httpd.conf is here: [darkarid.ufouni.cz ]. Thank you very much in advance!
Paul, Prague

phranque

4:14 am on Nov 4, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, Paul!

what does "not working" mean?
what response did you get?

i would check to server error log file for clues and if that doesn't show anything helpful i would try enabling the rewrite log and see if that reveals anything.

eriol

12:22 pm on Nov 7, 2011 (gmt 0)

10+ Year Member



Hi Phranque, thank you for your reply.

"Not working" means, that the URL of virtualHost (I want to be redirected by RewriteRule) goes to URL given by ProxyPass earlier in configuration file. RewriteRule is, by some faulty syntax, I guess, not working.
So I will get to the URL 10.0.0.2, which is IIS machine with aspx web, but with error (not recognizeable URL which is not defined in /IISAspx application)..

Log shows only:
192.168.11.95 - - [07/Nov/2011:12:52:20 +0100] "GET /Error.aspx?aspxerrorpath=/default.aspx HTTP/1.1" 200 3952
192.168.11.95 - - [07/Nov/2011:12:52:20 +0100] "GET /css/styles.css HTTP/1.1" 304 0
192.168.11.95 - - [07/Nov/2011:12:52:20 +0100] "GET /WebResource.axd?d=jJWNu-1O0H3pEr9_3CEID0wXfUBr5DrkP15H-hENdmrQaFS4wQRFtPDk8zU0GR4r-DoUR5kE0_OEiqHtN45tnCb4MbY1&t=634210436612724343 HTTP/1.1" 304 0
192.168.11.95 - - [07/Nov/2011:12:52:20 +0100] "GET /css/print.css HTTP/1.1" 304 -
192.168.11.95 - - [07/Nov/2011:12:52:20 +0100] "GET /pics/N-background.png HTTP/1.1" 304 -
192.168.11.95 - - [07/Nov/2011:12:52:20 +0100] "GET /pics/N-logo.png HTTP/1.1" 304 -

Thank you for your time..

phranque

6:06 am on Nov 14, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



do you have a custom ErrorDocument 404 configured in the server config or .htaccess?

lucy24

8:13 am on Nov 14, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Log shows only:

Please say you don't mean that literally. What about the referer and UA entries? I find it very hard to believe that your listed group of files is not being called by the first item on the list, /Error.aspx et cetera. So at least that file exists and is working as intended. In fact, it seems to have worked-as-intended repeatedly, judging by the string of 304's ;)

?aspxerrorpath=/default.aspx

Again, that really looks like one of those useful query strings that carries its own answer. Does it mean that you (or an earlier Redirect) tried to get to /default.aspx but it doesn't exist?

I even tried the RewriteRule without "/" in regular expession, but no result there.

Do you mean it behaved the same as the with-slash version, or that nothing at all happened? A leading slash in the "Pattern" will always fail unless you get a malformed request like "www.example.com//filename.asp"

phranque

1:56 pm on Nov 15, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I have an Apache/1.3.29@OpenBSD httpd.conf configured...

A leading slash in the "Pattern" will always fail unless you get a malformed request...

that would be true in per-directory configuration context (.htaccess) but in the per-server configuration context (httpd.conf) the leading slash is there as originally requested.

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html [httpd.apache.org]:
Note: Pattern matching in per-directory context

Never forget that Pattern is applied to a complete URL in per-server configuration files. However, in per-directory configuration files, the per-directory prefix (which always is the same for a specific directory) is automatically removed for the pattern matching and automatically added after the substitution has been done.