Not working RewriteRule / VirtualHost issue

Alles, was den Apache betrifft, kann hier besprochen werden.

Not working RewriteRule / VirtualHost issue

Postby eriol » 03. November 2011 14:53

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 : (

Code: Select all
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 ^/(.*) http://10.0.0.2:81/$1 [L,P]
RewriteRule ^/(.*) http://www.whatever.com/$1 [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: http://darkarid.ufouni.cz/httpdHELP.conf. Thank you very much in advance!
Paul, Prague
eriol
 
Posts: 2
Joined: 03. November 2011 14:49
Operating System: W7

Re: Not working RewriteRule / VirtualHost issue

Postby Nobbie » 05. November 2011 09:24

>RewriteRule ^/(.*) http://www.whatever.com/$1 [L,P]

Ommit "^/" in your pattern, its wrong. Simply use "(.*)".

P.S.: ... and be sure, you loaded mod_rewrite!
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: Not working RewriteRule / VirtualHost issue

Postby eriol » 07. November 2011 13:25

Hi Nobbie, thank you for your advice!
Sadly, I tried you recommendation and I had no impact on the result : (

If further info will be helpfull:
"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 IIS/Aspx application)..

Log shows only:
Code: Select all
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 -
eriol
 
Posts: 2
Joined: 03. November 2011 14:49
Operating System: W7


Return to Apache

Who is online

Users browsing this forum: No registered users and 266 guests