I have this code here at the top of all my pages:
<base href="http://example.com/dev/">
and in this page (http://example.com/dev/index.php/foo/bar/) I have this code:
<link rel="stylesheet" type="text/css" href="style/common.css" />
However my browser keeps trying to load:
http://example.com/dev/index.php/foo/style/common.css
when it should be:
http://example.com/dev/style/common.css
**UPDATE **
<html>
<head>
<base href="http://example.com/dev/" />
<link rel="stylesheet" type="text/css" href="/style/video.css" />
<link rel="stylesheet" type="text/css" href="/style/common.css" />
Am I doing something wrong?
Peter
The <base> tag specifies the base URL and/or target for all relative URLs in a document. The <base> tag must have either an href or a target attribute present, or both. There can only be one single <base> element in a document, and it must be inside the <head> element.
Definition and Usage The href attribute specifies the base URL for all relative URLs on a page.
The <base> HTML element specifies the base URL to use for all relative URLs in a document. There can be only one <base> element in a document. A document's used base URL can be accessed by scripts with Node. baseURI . If the document has no <base> elements, then baseURI defaults to location.
I had a similar problem. The problem occurred when the page was fed through a cgi. This did not work for me:
<base href="http://example.com/dev/">
but, the following does:
<base href="/dev/">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With