|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
VeriSign Code Signing Digital Certificates provides assurance to end users. Read about this and more in the free white paper: “How to Digitally Sign Downloadable Code for Secure Content Transfer.” Learn More! |
|
#1
|
|||
|
|||
|
Problem:
Trying to setup mass virtual hosting via mod_rewrite example: http://www.engelschall.com/pw/apache/rewriteguide. Looking to set virtual host document root based on incoming URI. The lookup in in the text vhost map fails because the key being passed to it is "%1" and not the value from the previous RewriteCond. rewrite.log: 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (2) init rewrite engine with requested uri /Sites/default.html 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (3) applying pattern '^/(.*)$' to uri '/Sites/default.html' 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (4) RewriteCond: input='' pattern='!^/commonurl1/.*' => matched 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (4) RewriteCond: input='' pattern='!^/commonurl2/.*' => matched 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (4) RewriteCond: input='testqa16:82' pattern='!^$' => matched 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (5) map lookup OK: map=lowercase key=%{HTTP_HOST -> val=%{http_host 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (4) RewriteCond: input='%{http_host|NONE}' pattern='^(.+)$' => matched 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (6) cache lookup FAILED, forcing new map lookup 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (5) map lookup FAILED: map=vhost[txt] key=%1 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (4) RewriteCond: input='' pattern='^(/.*)$' => not-matched 10.207.13.51 - - [22/Nov/2000:14:29:09 -0800] [realwww.foo.com/sid#a1af8][rid#b7a80/initial] (1) pass through /Sites/default.html Question: Why does map=lowercase key=%{HTTP_HOST AND map=vhost[txt] key=%1 NOT have the replaced values for these lookups? |
|
#2
|
|||
|
|||
|
>>map lookup OK: map=lowercase key=%{HTTP_HOST-> val=%{http_host
Converting HTTP_HOST to http_host doesn't do what you want. To convert to lowercase, I would do: <IfModule mod_rewrite.c> RewriteEngine on RewriteMap lc int:tolower </IfModule> Example: RewriteRule ^([A-Za-z0-9_]+)([^/A-Za-z0-9_]+)/?$ $1/$2/ RewriteRule ^([^/]+)/?(.*)/$ index.php?category=${lc:$1}&id=$2 [T=application/x-httpd-php,L] $1, the category, will convert to lowercase while $2, the id, remains as is. |
|
#3
|
|||
|
|||
|
The IfModule idiom is useful, thanks. I found one error in my httpd.conf:
RewriteCond %{REQUEST_URL} ... should be RewriteCond %{REQUEST_URI} The docs have REQUEST_URL with the letter "L" where the variable is "REQUEST_URI" with an "I". The key=%1 is still incorrect. When I run the same config params on another platform the key="testqa16:82" value is correct?! |
|
#4
|
|||
|
|||
|
The problem seems to be isolated to 1.3.14. When I compile apache 1.3.9 + mod_rewrite the key is correctly passed to the script/program/text file.
The problem exists under Solaris 2.6 and 2.8. I will check if apache 1.3.14 under linux exhibits the same problem. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > mod_rewite problems unders Solaris 8 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|