Base Href vs. .htaccess RewriteBase

Posted by Wayne on Stack Overflow See other posts from Stack Overflow or by Wayne
Published on 2010-06-01T16:00:53Z Indexed on 2010/06/01 16:03 UTC
Read the original article Hit count: 434

Normally I use

<base href="http://domain.com/" /><!--[if ie]></base><![endif]--> 

I haven't tried much with RewriteBase, I normally get confused and keep changing it till it works. Which method would be best, I obviously find the best solution because the links stay the same so that no links are broken most of the time when attaching a css file, e.g.

http://domain.com/css/main.css

It just always stay the same when accessing to sub-directories. Although, when I don't use the tag, and I access to a sub directory, it breaks the css links when I use

<link href="css/main.css" rel="stylesheet" type="text/css" />

As my PHP documents would include the header,

<?php include("include/global_header.php"); ?>

If I do that without the I would have to use:

<link href="../css/main.css" rel="stylesheet" type="text/css" />

Which can break when accessing to a sub-directory.

So... does the RewriteBase work the same as the ?

Your thoughts.

© Stack Overflow or respective owner

Related posts about url-rewriting

Related posts about stylesheet