httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jsl...@gmail.com>
Subject Re: [users@httpd] mod_rewrite internal redirect problem
Date Fri, 16 Sep 2005 16:21:16 GMT
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


Mime
View raw message