httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Huddleston <fhudd...@yahoo.com>
Subject Re: [users@httpd] mod_rewrite to fix trailing slash problem
Date Thu, 15 May 2008 23:25:18 GMT
You've probably already seen this, but just in case: I see in the config 
file in the "Alias" section, this:
 # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

This web page, or these web pages, wouldn't happen to be directed via 
aliases with trailing slashes, would they? Looks as though that would 
cause the symptom you
are describing. I doubt this is new behaviour with 2.2, though.

Frank Huddleston

Tim Gustafson wrote:
> Hi,
>
> I have a web page that works when you include the trailing slash:
>
> http://www.foo.com/blah/
>
> But, if you leave the trailing slash off, it does not work and you get a 403
> error:
>
> http://www.foo/com/blah
>
> 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
> tjg@soe.ucsc.edu
> (831) 459-5354
>
>
>
> ---------------------------------------------------------------------
> 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