Re: [users@httpd] mod_rewrite internal redirect problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/16/05, Todd <thsiegel@xxxxxxxxx> 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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux