Forum Moderators: phranque

Message Too Old, No Replies

rewritten url is parsed again

         

icey

4:20 pm on Feb 13, 2004 (gmt 0)

10+ Year Member



Hi, I'm rewriting a dynamo url into a static one, but find that even with the last (L) directive, it still parses, seemingly because the url is rewritten and therefore "new" to the processor. i've set up a defensive rule so that it does not check all the conditions (or images!) the second time around, but is it possible to prevent this second parse altogether?

below are the two rules i have, and the rewrite log turned on to 9.

thanks in advance for your help!

httpd.conf
==================
# want to map /zzzzzzzzzzz/blarrrrgh -> /index.php?zzzzzzzzzzz=blarrrrgh

# defense check
RewriteRule!(^zzzzzzzzzzz/.*)$ - [L]

# rewriterule
RewriteRule ^zzzzzzzzzzz/(.*)/$ /index.php?zzzzzzzzzzz=$1 [T=application/x-httpd-php,L]

rewrite log
===============
(2) init rewrite engine with requested uri /zzzzzzzzzzz/blarrrrgh
(1) pass through /zzzzzzzzzzz/blarrrrgh
(3) [per-dir /www/htdocs/] add path-info postfix: /www/htdocs/zzzzzzzzzzz -> /www/htdocs/zzzzzzzzzzz/blarrrrgh
(3) [per-dir /www/htdocs/] strip per-dir prefix: /www/htdocs/zzzzzzzzzzz/blarrrrgh -> zzzzzzzzzzz/blarrrrgh
(3) [per-dir /www/htdocs/] applying pattern '^zzzzzzzzzzz/(.*)$' to uri 'zzzzzzzzzzz/blarrrrgh'
(5) map lookup OK: map=uppercase key=blarrrrgh -> val=blarrrrgh
(2) [per-dir /www/htdocs/] rewrite zzzzzzzzzzz/blarrrrgh -> index.php?zzzzzzzzzzz=blarrrrgh
(3) split uri=index.php?zzzzzzzzzzz=blarrrrgh -> uri=index.php, args=zzzzzzzzzzz=blarrrrgh
(3) [per-dir /www/htdocs/] add per-dir prefix: index.php -> /www/htdocs/index.php
(2) [per-dir /www/htdocs/] trying to replace prefix /www/htdocs/ with /
(5) strip matching prefix: /www/htdocs/index.php -> index.php
(4) add subst prefix: index.php -> /index.php
(1) [per-dir /www/htdocs/] internal redirect with /index.php [INTERNAL REDIRECT]
(2) init rewrite engine with requested uri /index.php
(1) pass through /index.php
(3) [per-dir /www/htdocs/] strip per-dir prefix: /www/htdocs/index.php -> index.php
(3) [per-dir /www/htdocs/] applying pattern '(^zzzzzzzzzzz/.*)$' to uri 'index.php'
(1) [per-dir /www/htdocs/] pass through /www/htdocs/index.php
(2) init rewrite engine with requested uri /index.php
(1) pass through /index.php
(3) [per-dir /www/htdocs/] strip per-dir prefix: /www/htdocs/index.php -> index.php
(3) [per-dir /www/htdocs/] applying pattern '(^zzzzzzzzzzz/.*)$' to uri 'index.php'
(1) [per-dir /www/htdocs/] pass through /www/htdocs/index.php
(2) init rewrite engine with requested uri /logo.jpg
(1) pass through /logo.jpg
(3) [per-dir /www/htdocs/] strip per-dir prefix: /www/htdocs/logo.jpg -> logo.jpg

jdMorgan

8:19 pm on Feb 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



icey,

Welcome to WebmasterWorld [webmasterworld.com]!

> but is it possible to prevent this second parse altogether?

Not that I know of. If you change (rewrite) a URL in .htaccess, then Apache must start over from the beginning to "revalidate" it (Check for 404, etc.). Therefore, your "defensive rule" is the commonly-used work-around.

Jim

icey

10:24 pm on Feb 13, 2004 (gmt 0)

10+ Year Member



Thanks much! :) I figured it was hopeless, but I thought I'd try. I actually was also concerned about the fact that there are two redirects, but they might be related to a servername redirect. Thanks again!