httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Gustafson" <>
Subject [users@httpd] mod_rewrite to fix trailing slash problem
Date Thu, 15 May 2008 15:59:53 GMT

I have a web page that works when you include the trailing slash:

But, if you leave the trailing slash off, it does not work and you get a 403

So, I tried to fix this using some mod_rewrite rules, as follows:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1/ [R,L]

But it seems that the "-d" test is always failing.  If I comment that part
out, then *everything* gets a "/" appended to the end, which of course
doesn't work.  I tried using "!-f" instead, and got similarly bad results.

I've Googled this and read lots of solutions that all look more or less like
what I've posted above, but none of them seem to actually work.

Is there something I'm missing here?

FWIW, I'm running Apache 2.2 on CentOS 5.1.

Thanks for any help you can give!

Tim Gustafson
SOE Webmaster
UC Santa Cruz
(831) 459-5354

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