[Zope] URLs and /

Charlie Reiman creiman@kefta.com
Tue, 6 Aug 2002 11:06:14 -0700


I've had this problem and only just now come up with a solution.
Unforunately, I don't have time to implement real code, so you'll have to
muddle through my pseudo-code suggestions. If done correctly, you could
throw this in the root of your site and then just place all your main
content in main_html.

Create an index_html python script that looks like this:

if traverse_subpath[-1] == 'index_html':
  return call_in_context main_html
else:
  redirect traverse_subpath+'index_html'.to_string()

Yeah, I know it isn't close to right but I'm terribly busy right now.
Hopefully someone has a better (working) suggestion.

Good luck. Share if you find a solution.

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of DA
> Loeffler
> Sent: Tuesday, August 06, 2002 3:46 AM
> To: zope@zope.org
> Subject: [Zope] URLs and /
>
>
>
> I have been experiencing a problem with relative URLs.
>
> If I have a folder 'myFolder' and the user enters the
> address [mysite]/myFolder, they are automatically redirected to
> [mysite]/myFolder/index_html, but their browser does not realise this.
> So if I have a relative link in the page <a href="somefile"> which is
> intended to point at /myFolder/somefile, the browser, thinking it is
> reading a _file_ called 'myFolder' in the root folder, then requests
> /somefile, not /myFolder/somefile, and Zope quite rightly replies that
> it doesn't exist.
>
> How do I get round this one? For ordinary links it can be fixed with a
> <base> tag whose href is set to absolute_url(), but this isn't respected
> by JavaScript window.location.href="" statements. The only solution I
> have found so far is for index_html to do a RESPONSE.redirect to a
> different file, whose URL is then right, but this is grungy. Does anyone
> have any better ideas?
>
>
> David
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>