You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Brian Leader <br...@ideaslive.com> on 2003/06/29 16:10:51 UTC

[users@httpd] A trailing slash is required in a URL

Hello,

Sometimes when I configure a website, in order to show the default 
document, e.g. index.html, I'm required to use a trailing slash.  For 
instance, if I use the url: http://mysite.com/test (where I have index.html 
in the test directory), I get an error.  But if I use 
http://mysite.com/test/ (note trailing "/"), it works.  Any ideas how to 
prevent the trailing slash requirement?

Thanks,

Brian


---------------------------------------------------------------------
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


Re: [users@httpd] A trailing slash is required in a URL

Posted by Robert Andersson <ro...@profundis.nu>.
Robert Andersson wrote:
> <Directory /usr/tomcat/webapps/test>
>     Indexes main.jsp
> </Directory>

Of course, the weekly reminder that one should not post prior to coffee
treatment ;)

The correct directive is DirectoryIndex, not Indexes.

Regards,
Robert Andersson




---------------------------------------------------------------------
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


Re: [users@httpd] A trailing slash is required in a URL

Posted by Robert Andersson <ro...@profundis.nu>.
Brian Leader wrote:
> Alias /test /usr/tomcat/webapps/test/main.jsp
> ...snip...
> When I request myserver.com/test, I get the following:
>
> Not Found (404)
> Original request: /contents.jsp
>
> Not found request: /contents.jsp

That is understandable. To the browser, it looks like your frameset document
is in the root (/test), and so will request the frame documents relative to
root. In your case, there is no way for Apache to know that your alias /test
is a directory, so it won't do trailing slash magic for you when you request
http://yourhost/test.

A way around it, is to adjust the alias to point to the directory (not the
file), in which case Apache do handle the trailing slash problem, and add
the main.jsp file to index file list:

Alias /test /usr/tomcat/webapps/test

<Directory /usr/tomcat/webapps/test>
    Indexes main.jsp
</Directory>


Regards,
Robert Andersson




---------------------------------------------------------------------
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


Re: [users@httpd] A trailing slash is required in a URL

Posted by Brian Leader <br...@ideaslive.com>.
Thanks, this worked.  By the way, I'm using Apach version 1.3.27.

I'm having another related problem...

After I set up the alias, it was able to find the requested URL without the 
trailing slash.  It was a path to a .jsp file.  But now the jsp file cannot 
find its own relative URLs which are in the same directory.  For example, I 
use the alias:

	Alias /test /usr/tomcat/webapps/test/main.jsp

The file main.jsp is:

<html>
<head>
  <center>
    <frameset rows="0%, *">
      <frame src="head.jsp">
      <frame src="contents.jsp">
    </frameset>
  </center>
</html>

When I request myserver.com/test, I get the following:

	Not Found (404)
	Original request: /contents.jsp

	Not found request: /contents.jsp

Any idea how to resolve these URLs?

Thanks,

Brian


On Sun, 29 Jun 2003 10:29:12 -0400 (Est (heure d'été)), Joshua Slive 
<jo...@slive.ca> wrote:

>
> On Sun, 29 Jun 2003, Brian Leader wrote:
>
>> Hello,
>>
>> Sometimes when I configure a website, in order to show the default
>> document, e.g. index.html, I'm required to use a trailing slash.  For
>> instance, if I use the url: http://mysite.com/test (where I have 
>> index.html
>> in the test directory), I get an error.  But if I use
>> http://mysite.com/test/ (note trailing "/"), it works.  Any ideas how to
>> prevent the trailing slash requirement?
>
> See:
> http://httpd.apache.org/docs/misc/FAQ.html#set-servername
>
> Joshua.
>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


---------------------------------------------------------------------
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


Re: [users@httpd] A trailing slash is required in a URL

Posted by Brian Leader <br...@ideaslive.com>.
Thanks, this worked.  By the way, I'm using Apach version 1.3.27.

I'm having another related problem...

After I set up the alias, it was able to find the requested URL without the 
trailing slash.  It was a path to a .jsp file.  But now the jsp file cannot 
find its own relative URLs which are in the same directory.  For example, I 
use the alias:

	Alias /test /usr/tomcat/webapps/test/main.jsp

The file main.jsp is:

<html>
<head>
  <center>
    <frameset rows="0%, *">
      <frame src="head.jsp">
      <frame src="contents.jsp">
    </frameset>
  </center>
</html>

When I request myserver.com/test, I get the following:

	Not Found (404)
	Original request: /contents.jsp

	Not found request: /contents.jsp

Any idea how to resolve these URLs?

Thanks,

Brian


On Sun, 29 Jun 2003 10:29:12 -0400 (Est (heure d'été)), Joshua Slive 
<jo...@slive.ca> wrote:

>
> On Sun, 29 Jun 2003, Brian Leader wrote:
>
>> Hello,
>>
>> Sometimes when I configure a website, in order to show the default
>> document, e.g. index.html, I'm required to use a trailing slash.  For
>> instance, if I use the url: http://mysite.com/test (where I have 
>> index.html
>> in the test directory), I get an error.  But if I use
>> http://mysite.com/test/ (note trailing "/"), it works.  Any ideas how to
>> prevent the trailing slash requirement?
>
> See:
> http://httpd.apache.org/docs/misc/FAQ.html#set-servername
>
> Joshua.
>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


---------------------------------------------------------------------
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


Re: [users@httpd] A trailing slash is required in a URL

Posted by Joshua Slive <jo...@slive.ca>.
On Sun, 29 Jun 2003, Brian Leader wrote:

> Hello,
>
> Sometimes when I configure a website, in order to show the default
> document, e.g. index.html, I'm required to use a trailing slash.  For
> instance, if I use the url: http://mysite.com/test (where I have index.html
> in the test directory), I get an error.  But if I use
> http://mysite.com/test/ (note trailing "/"), it works.  Any ideas how to
> prevent the trailing slash requirement?

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

Joshua.

---------------------------------------------------------------------
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


RE: [users@httpd] A trailing slash is required in a URL

Posted by Sander Holthaus - Orange XL <in...@orangexl.com>.
That's odd, this should be done by default (adding the trailing slash).
Which version are you using?

Kind regards,
Sander Holthaus

-----Original Message-----
From: Brian Leader [mailto:brian@ideaslive.com] 
Sent: zondag 29 juni 2003 16:11
To: users@httpd.apache.org
Subject: [users@httpd] A trailing slash is required in a URL


Hello,

Sometimes when I configure a website, in order to show the default 
document, e.g. index.html, I'm required to use a trailing slash.  For 
instance, if I use the url: http://mysite.com/test (where I have index.html 
in the test directory), I get an error.  But if I use 
http://mysite.com/test/ (note trailing "/"), it works.  Any ideas how to 
prevent the trailing slash requirement?

Thanks,

Brian


---------------------------------------------------------------------
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



---------------------------------------------------------------------
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