Forum Moderators: phranque
---
I'm using mod_rewrite to route URLs to a module done as a Location:
LoadModule BoldRetina_module modules/mod_BoldRetina.so
<Location /BoldRetina >
SetHandler mod_boldretina-handler
</Location>
RewriteEngine On
ReWriteLog c:\rewrite.log.txt
ReWriteLogLevel 9
# now the rewriting rules
# Root directory is mapped to ShowUI?UI=Home
# So incoming: www.mydomain.com/ becomes
www.mydomain.com/BoldRetina/ShowUI?UI=Home
RewriteRule ^/$ /BoldRetina/ShowUI\?UI=Home [L]
I don't want this to be a redirect that the browser sees, so I'm not
using R=301
The problem....
In my log file I get:
192.168.0.1 - - [07/Jan/2003:14:55:02 +0000]
[bryan/sid#23bd68][rid#472f30/initial] (2) init rewrite engine with
requested uri /
192.168.0.1 - - [07/Jan/2003:14:55:02 +0000]
[bryan/sid#23bd68][rid#472f30/initial] (3) applying pattern '^/$' to uri
'/'
192.168.0.1 - - [07/Jan/2003:14:55:02 +0000]
[bryan/sid#23bd68][rid#472f30/initial] (2) rewrite / ->
/BoldRetina/ShowUI?UI=Home
# I want it to stop here, but it does two more steps....
192.168.0.1 - - [07/Jan/2003:14:55:02 +0000]
[bryan/sid#23bd68][rid#472f30/initial] (3) split
uri=/BoldRetina/ShowUI?UI=Home -> uri=/BoldRetina/ShowUI, args=UI=Home
192.168.0.1 - - [07/Jan/2003:14:55:02 +0000]
[bryan/sid#23bd68][rid#472f30/initial] (2) local path result:
/BoldRetina/ShowUI
How can I stop it splitting the query string out into the args string?
The module I'm using requires the query string to be part of the URL.
---
Can anyone suggest what we can do to address this issue? Thanks. :)
Given a RewriteRule
RewriteRule /acarter /index.php?para=acarter
and a php script like
<?php echo $_SERVER['QUERY_STRING'];?>
you get
para=acarter
when /acarter is requested. Yet the RewriteLog still shows
init rewrite engine with requested uri /acarter
applying pattern '/acarter' to uri '/acarter'
rewrite /acarter -> /index.php?para=acarter
split uri=/index.php?para=acarter
-> uri=/index.php, args=para=acarter
local path result: /index.php
prefixed with document_root to /var/www/html/index.php
go-ahead with /var/www/html/index.php [OK]
The splitting is only necessary to continue any matching. If it mod_rewrite did not strip off the query string from the end of the URI then a rule like this would not work:
RewriteRule /index.php$ /do_whatever
Since index.php would end with index.php?para=acarter.
Your module should be able to retrieve the query string from the query field of the uri_components record. This record may be accessed via the parsed_uri field of every incoming request.
Andreas
I'm John's software designer. The module is written in Delphi, and I don't have the source...
Interestingly, if I specify a 301 redirect, it works ok, although the user's browser sees the internal path. If I don't it doesn't work - I get a 404.
Could this be something to do with the ordering of Apache url flow? In that the module Location isn't being used after mod_rewrite. Should the modules be declared in any particular order?
Bryan
Be sure to read Marcia`s WebmasterWorld Welcome and Guide to the Basics [webmasterworld.com] post.
Could this be something to do with the ordering of Apache url flow? In that the module Location isn't being used after mod_rewrite. Should the modules be declared in any particular order?
Try changing the order of the AddModule (mod_rewrite.c¦your_module) directives in httpd.conf.
Interestingly, if I specify a 301 redirect, it works ok, although the user's browser sees the internal path.
It works since mod_rewrite does not do anything on the second request.
Andreas