You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Klavs Klavsen <kl...@vsen.dk> on 2003/06/06 08:48:56 UTC

[users@httpd] rewrite rule problem

Hi guys,

Why doesn't this work?

Options FollowSymLinks

RewriteEngine On
RewriteOptions 'inherit'

RewriteMap lowercase int:tolower

# don't try to urls not ending in .html
RewriteRule !^([^/]*)/([^/]+)\.html$ - [L]

# match www.*.* - and set ENV:VHOST = domainname
RewriteCond   %{HTTP_HOST}              ^www\.[^.]+\.[^-]+$ [NC]
RewriteRule   ^(.+)                     ${lowercase:%{HTTP_HOST}}$1 [C]
RewriteRule   ^www\.([^.]+)\.([^/.]+)(.*)       $3      [E=VHOST:$1,PT]

# match *.* - and set ENV:VHOST = domainname
RewriteCond   %{HTTP_HOST}              ^[^.]+\.[^-]+$ [NC]
RewriteRule   ^(.+)                     ${lowercase:%{HTTP_HOST}}$1 [C]
RewriteRule   ^([^.]+)\.([^/.]+)(.*)    $3              [E=VHOST:$1,PT]

# rewrite Page-(id).html to real file.
RewriteRule (.*)/Page-([0-9]+)\.html$
%{ENV:VHOST}/html/$1index.php?pageid=$2 [L,NS]

The VHOST var is set, so it "works", according to the rewrite.log:

] (3) applying pattern '^([^/]*)/([^/]+)\.html$' to uri '/Page-3.html'
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (3) applying pattern '^(.+)' to uri '/Page-3.html'
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (4) RewriteCond: input='defaulttest.dk' pattern='^www\.[^.]+\.[^-]+$'
=> not-matched
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (3) applying pattern '^(.+)' to uri '/Page-3.html'
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (4) RewriteCond: input='defaulttest.dk' pattern='^[^.]+\.[^-]+$' =>
matched
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (5) map lookup OK: map=lowercase key=defaulttest.dk ->
val=defaulttest.dk
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (2) rewrite /Page-3.html -> defaulttest.dk/Page-3.html
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (3) applying pattern '^([^.]+)\.([^/.]+)(.*)' to uri
'defaulttest.dk/Page-3.html'
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (2) rewrite defaulttest.dk/Page-3.html -> /Page-3.html
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (5) setting env variable 'domain' to 'defaulttest'
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (3) applying pattern '(.*)/Page-([0-9]+)\.html$' to uri '/Page-3.html'
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (2) rewrite /Page-3.html ->
defaulttest/html/index.php?name=PagEd&page_id=3
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (3) split uri=defaulttest/html/index.php?pageid=3 ->
uri=defaulttest/html/index
.php, args=name=PagEd&page_id=3
192.168.1.4 - - [04/Jun/2003:15:58:47 +0200]
[defaulttest.dk/sid#8113c08][rid#822fa48/initial
] (2) local path result: defaulttest/html/index.php

But the error log says:

 Invalid URI in request GET /Page-3.html HTTP/1.1

Any ideas?

Thankyou in advance.

-- 
Regards,
Klavs Klavsen, GSEC - kl@vsen.dk - http://www.vsen.dk

Working with Unix is like wrestling a worthy opponent. 
Working with windows is like attacking a small whining child 
who is carrying a .38.				



---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] mod_proxy for apache1.3

Posted by Suba Arunkumar <su...@yahoo.com>.
I have added the below listed three lines in the
virtual host configuration.

RewriteEngine On
  ProxyPassReverse / http:%{HTTP_HOST}:8088/
  RewriteCond %{REQUEST_URI}
!.*\.(jpg|gif|pdf|png|zip)$
  RewriteRule ^/(.*) http://%{HTTP_HOST}:8088/$1 [P]

when i connect to the website it gives me an error
message
"
 The proxy server could not handle the request GET�/.

 Reason: Host not found
"
In the httpd-access log i see the below listed lines.

"GET / HTTP/1.1" 500 434 "-" "Mozilla/5.0 (compatible;
Konqueror/3.1)"


Can anyone help me to find out what might be the
problem.

Regards
S Arun


 

 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org