httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd <thsie...@yahoo.com>
Subject Re: [users@httpd] mod_rewrite internal redirect problem
Date Fri, 16 Sep 2005 16:36:13 GMT
Thanks Joshua.

I moved the RewriteRule out of the <Directory> config and into the main server
config: 

RewriteRule ^/myalias/(.*)\.html$ /myalias/page_processor.php?page_requested=$1
[PT]

But I still have the same issue the query parameter disappearing.  Here's the
new log:

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

initial] (3) applying pattern '^/myalias/(.*)\.html$' to uri
'/myalias/directory/file.html'

initial] (2) rewrite /myalias/directory/file.html ->
/myalias/page_processor.php?page_requested=directory/file

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

initial] (2) forcing '/myalias/page_processor.php' to get passed through to
next API URI-to-filename handler

Thanks again,
Todd

--- Joshua Slive <jslive@gmail.com> wrote:

> On 9/16/05, Todd <thsiegel@yahoo.com> wrote:
> > 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.
> 
> I'm not sure exactly what is going wrong, but a couple suggestions
> that should help:
> 
> 1. Put your RewriteRules in the main part of httpd.conf, rather than
> in a <Directory> section.  This avoids any RewriteBase problems and
> generally makes things clearer.
> 
> 2. If you want to combine an Alias with a RewriteRule, you'll need the
> [PT] flag on the RewriteRule.  But it is often simpler to convert the
> Alias into a RewriteRule so that the order of processing becomes
> clearer.
> 
> Joshua.
> 
> ---------------------------------------------------------------------
> 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
> 
> 


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