Click here to get back home

How do redirects influence the base URL of an HTML document

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How do redirects influence the base URL of an HTML document Carsten Leue 11-06-2007
Posted by Carsten Leue on November 6, 2007, 3:25 pm
Please log in for more thread options
How are browsers supposed to calculate the base URL of a resource
after a redirect?
The browser sends a request to

http://www.example.org/dir/index.html

and this results in a redirect to

http://www.example.org/newdir/index.html

the HTML served by index.html contains a CSS reference like this

<link href="styles.css" rel="stylesheet" type="text/css"
media="screen" >

Under which URL is the browser supposed to fetch the stylesheet?
(a) http://www.example.org/dir/styles.css
or
(b) http://www.example.org/newdir/styles.css

Does it make a difference if the redirect is a temporary redirect vs a
permanent redirect?
Thanks a lot for your advice,
Carsten


Posted by Rik Wasmus on November 9, 2007, 8:57 am
Please log in for more thread options
=

wrote:

> How are browsers supposed to calculate the base URL of a resource
> after a redirect?
> The browser sends a request to
>
> http://www.example.org/dir/index.html
>
> and this results in a redirect to
>
> http://www.example.org/newdir/index.html
>
> the HTML served by index.html contains a CSS reference like this
>
> <link href=3D"styles.css" rel=3D"stylesheet" type=3D"text/css"
> media=3D"screen" >
>
> Under which URL is the browser supposed to fetch the stylesheet?
> (a) http://www.example.org/dir/styles.css
> or
> (b) http://www.example.org/newdir/styles.css

(b), always, unless it's an internal redirect on the webserver and the =

browser still thinks it's looking at http://www.example.org/dir/styles.c=
ss.

> Does it make a difference if the redirect is a temporary redirect vs a=

> permanent redirect?

No.

If the stylesheet url must stay the same, use this: ' =

href=3D"/path/to/style.css"'.
-- =

Rik Wasmus

Posted by John Dunlop on November 9, 2007, 9:45 am
Please log in for more thread options
Carsten Leue:

> How are browsers supposed to calculate the base URL of a resource
> after a redirect?

Further to the answers given already, here is the relevant RFC
section:

http://www.apps.ietf.org/rfc/rfc3986.html#sec-5.1

--
Jock


Similar ThreadsPosted
A HTML document can be converted to XHTML document. January 31, 2005, 8:58 am
Is there a difference between html document and html file? May 15, 2008, 10:05 am
How does a browser parse an html document? January 25, 2006, 9:25 am
Document trailers : can anything legitimately follow August 6, 2004, 5:36 pm
How can I dynamically add file links to a html document? May 31, 2005, 7:40 am
HTML form (XForms) --> XML Document without a web server? November 26, 2007, 11:33 am
Redirects October 5, 2004, 10:36 am
Inserting Live Audio onto a Basic HTML Document October 26, 2004, 1:25 pm
Extracting Semantic Structure of HTML Document- Feature based January 30, 2005, 7:43 pm
? Storing Internal Information In An HTML Document (eg Inside Tags) February 1, 2005, 4:08 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap