httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd <thsie...@yahoo.com>
Subject [users@httpd] mod_rewrite internal redirect problem
Date Fri, 16 Sep 2005 16:09:18 GMT
I have a RewriteRule to change plain html-type URL to a PHP script that
dyanamically plugs in the content.  It looks like this...

Alias /myalias "C:/path/to/htdocs"

<Directory "C:/path/to/htdocs">
    ...
    RewriteEngine On
    RewriteBase /myalias
    RewriteRule ^(.*)\.html$ page_processor.php?page_requested=$1 [L]
</Directory>

Turned up the RewriteLogLevel (to 3) to see what's going on.  It seems to do
the rewrite correctly, but then does an internal redirect and drops the added
query parameter.  I've read the mod_rewrite docs and URL Rewriting Guide and I
have tinkered with it quite a bit.

I goal is to have the rewritten URL be
page_processor.php?page_reqested=directory/file, but I end up with only page
page_processor.php.  Please see below.

Thanks, Todd.

Here's the log snippet.  I removed some junk (IP Addr, Date, Time, etc) for
brevity:

initial] (2) init rewrite engine with requested uri
/myalias/directory/file.html

initial] (1) pass through /myalias/directory/file.html

initial] (3) [per-dir C:/path/to/htdocs/] strip per-dir prefix:
C:/path/to/htdocs/directory/file.html -> directory/file.html

initial] (3) [per-dir C:/path/to/htdocs/] applying pattern '^(.*)\.html$' to
uri 'directory/file.html'

initial] (2) [per-dir C:/path/to/htdocs/] rewrite directory/file.html
 -> page_processor.php?page_requested=directory/file

initial] (3) split uri=page_processor.php?page_requested=directory/file ->
uri=page_processor.php, args=page_requested=directory/file

initial] (3) [per-dir C:/path/to/htdocs/] add per-dir prefix:
page_processor.php -> C:/path/to/htdocs/htdocs/page_processor.php

initial] (2) [per-dir C:/path/to/htdocs/] trying to replace prefix
C:/path/to/htdocs/ with /myalias

initial] (1) [per-dir C:/path/to/htdocs/] internal redirect with
/myalias/page_processor.php [INTERNAL REDIRECT]

initial/redir#1] (2) init rewrite engine with requested uri
/myalias/page_processor.php

initial/redir#1] (1) pass through /myalias/page_processor.php

initial/redir#1] (3) [per-dir C:/path/to/htdocs/] strip per-dir prefix:
C:/path/to/htdocs/page_processor.php -> page_processor.php

initial/redir#1] (3) [per-dir C:/path/to/htdocs/] applying pattern
'^(.*)\.html$' to uri 'page_processor.php'

initial/redir#1] (1) [per-dir C:/path/to/htdocs/] pass through
C:/path/to/htdocs/page_processor.php


---------------------------------------------------------------------
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