httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klavs Klavsen ...@vsen.dk>
Subject [users@httpd] rewrite rule problem
Date Fri, 06 Jun 2003 06:48:56 GMT
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


Mime
View raw message