httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] stripping trailing slash
Date Wed, 07 Jan 2004 19:00:29 GMT

On Wed, 7 Jan 2004, Ari Davidow wrote:
> > > >ReWriteRule ^/([-a-zA-Z0-9_]*)/*$ /myscript/$1 [T=application/x-httpd-php]

> Going through the RewriteLog we determined that the Rewrite =was= working
> as expected -- the problem actually lay inside the PHP script, where the
> variable REQUEST_URI was being parsed to get the string. That variable was
> not affected by the rewrite (should it have been? if so, any ideas why it
> wasn't changed?). Is this the wrong environment variable to use? Is anyone
> familiar with PHP who would know what should properly be used instead?

REQUEST_URI shows the actual request from the client.  You can either deal
with that in your php script, or you can tell the client to correct their
request using an external redirect.  This may be a good idea for other
reasons --- it's wise to only have one URL that points to any particular
resource.  A technique to do that would be something like

RewriteRule ^(/[^/]+)/ $1 [R]

ReWriteRule ^/([-a-zA-Z0-9_]*)$ /myscript/$1 [T=application/x-httpd-php]


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message