You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by jon shoberg <js...@cbd.net> on 2002/04/16 08:07:29 UTC

Directory Indexes

I have a website setup right now jsut via IP address. So when I look at
http://10.0.0.104/data/A/ AND include the trailing slash, it digs up the
index.html document and displays it.  When I look at
http://10.0.0.104/data/A WITH NO trailing slash, I got a 404 error.

Without cutting and pasting my whole conf in the email, any ideas.  I'd jsut
like to have it pull up index.html without the tailing slash.

Thanks


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Directory Indexes

Posted by Owen Boyle <ob...@bourse.ch>.
jon shoberg wrote:
> 
> I have a website setup right now jsut via IP address. So when I look at
> http://10.0.0.104/data/A/ AND include the trailing slash, it digs up the
> index.html document and displays it.  When I look at
> http://10.0.0.104/data/A WITH NO trailing slash, I got a 404 error.
> 
> Without cutting and pasting my whole conf in the email, any ideas.  I'd jsut
> like to have it pull up index.html without the tailing slash.

This behaviour is perfectly normal and arises from the common
misconception that the trailing slash in a URL is some kind of optional
extra which the user can put on or leave off as his whim dictates.

In fact, it is rather important as it allows apache to differentiate
between a request for a directory (http://server/foo/) and a file
(http://server/foo). If it was up to me, you'd get a 404 every time you
tried to fetch a directory with a file URL... But, apache is cleverer
than that - if you request something that looks like a file (i.e. no
trailing slash) but apache can't find a file like that, it assumes you
might really want a directory so it sends you back a redirect message
with a new URL with the trailing slash added. so what looks like a
single request and answer to the client is really a dialogue with two
requests and two answers.

The problem is, how does apache know whaich servername to put in the
redirect URL? The answer is it uses the value of the ServerName
directive - it also considers the setting of UseCanonicalName as well...
If you have several virtualhosts, the whole thing can get a bit messy.

Check out the documentation for these two directives if you want to
understand what's going on. 

If you just want a quick fix, put "UseCanonicalName off" into the VH and
apache will use the client's hostname:port in the redirect URL - so that
will probably work.

Rgds,

Owen Boyle.

PS - I wouldn't try anything to do with a rewrite (as suggested
elsewhere) - that sounds like a recipe for infinite recursion to me....

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Directory Indexes

Posted by Daniel Lopez <da...@rawbyte.com>.
This is a FAQ

http://httpd.apache.org/docs/misc/FAQ.html#set-servername

> 
> I have a website setup right now jsut via IP address. So when I look at
> http://10.0.0.104/data/A/ AND include the trailing slash, it digs up the
> index.html document and displays it.  When I look at
> http://10.0.0.104/data/A WITH NO trailing slash, I got a 404 error.
> 
> Without cutting and pasting my whole conf in the email, any ideas.  I'd jsut
> like to have it pull up index.html without the tailing slash.
> 
> Thanks
> 
> 
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


RE: Directory Indexes

Posted by Brian Bernardo <bb...@qwest.net>.
Try mod_rewrite: http://httpd.apache.org/docs/mod/mod_rewrite.html

There is a portion where you can specify ^/data/A to become /data/A/

B


-----Original Message-----
From: jon shoberg [mailto:jshoberg@cbd.net] 
Sent: Monday, April 15, 2002 11:07 PM
To: users@httpd.apache.org
Subject: Directory Indexes


I have a website setup right now jsut via IP address. So when I look at
http://10.0.0.104/data/A/ AND include the trailing slash, it digs up the
index.html document and displays it.  When I look at
http://10.0.0.104/data/A WITH NO trailing slash, I got a 404 error.

Without cutting and pasting my whole conf in the email, any ideas.  I'd
jsut
like to have it pull up index.html without the tailing slash.

Thanks


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org





---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org