Forum Moderators: phranque

Message Too Old, No Replies

xcuse me, more again in mod_rewirteCon,etc

Rewrite,RewriteCond

         

zcoral

10:09 am on Apr 7, 2005 (gmt 0)

10+ Year Member



Dear gentlemen,

I still got mess as the simplest codes below even can not pass:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^a\.example\.net\.nl$ [NC]
RewriteRule ^$ /products/aindex.jsp [L]

RewriteCond %{HTTP_HOST} ^b\.example\.net\.nl$ [NC]
RewriteRule ^$ /products/bindex.jsp [L]

notes:
I want to build up several simplest secondary subdomain name for the current several web-module entry. Above, as I metioned hours before, I thought it means:

if(httphost=="a.example.net.nl") then url=/products/aindex.jsp
if(httphost=="b.example.net.nl") then url=/products/bindex.jsp

not any interpretations else,right?

but in runtime, the first one interpret ok, but the next one just disappear, it went to the firt Virutalhost set in the httpd.conf, and response another absolute wrong page for me.

where I unerstood wrong for the RewriteCond as well as RewriteRule?

frederick

[edited by: jdMorgan at 1:53 pm (utc) on April 7, 2005]
[edit reason] Removed specifics per TOS. [/edit]

zcoral

10:12 am on Apr 7, 2005 (gmt 0)

10+ Year Member



I dont know what the system means, how so fast I posted then get one message invisible(?) for me?

sitz

10:17 am on Apr 7, 2005 (gmt 0)

10+ Year Member



Your interpretation of the RewriteCond/RewriteRule syntax is correct. To debug this, I'd suggest turning on the RewriteLog with the following directives:

RewriteLog /path/to/rewrite.log
RewriteLogLevel 9

Note that you should NOT do this on a production host; mod_rewrite logs a LOT of data, and production traffic would likely slow down while Apache wrote all this information to disk. This should be done on a non-production host (or at least a non-production <VirtualHost>). If this isn't possible, let us know, and we'll come up with something else.

zcoral

1:23 pm on Apr 7, 2005 (gmt 0)

10+ Year Member



thanks S,

these setting I have tested for manytimes but just puzzled what the second rewritecond do not work even in the same format. however, however, however, as long as I restart it again on afternoon, for the god sake, dont ask me why, it work ok?! I do not know whether it was some cache in apache did it , I realy just do not know

frederick

sitz

1:45 am on Apr 10, 2005 (gmt 0)

10+ Year Member



I find it unlikely that that's what actually going on; mod_rewrite is a fairly tight piece of code. A bug of that nature would have been seen LONG before now.

jdMorgan

1:56 am on Apr 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I do not know whether it was some cache in apache did it, I really just do not know.

More likely you already had a copy of the page at http://b.example.net.nl/ in your browser cache, so it was never re-fetched from your server. If it was not re-fetched from your server, then your code could not rewrite it.

Later in the day, your browser's cache of that page expired or was replaced by something newer, forcing a re-fetch, and then your rewrite code was invoked.

Jim