base href does not work for my site

Hello,
I use in all my html pages, then all css, images, … are pointed directly from the base directory.
However, it does not work for html files located in the “livres” directory for example.
Example: http://www.yoga-kids.net/livres/index.html contains and points to css files through href=“css/main.css”. But this css file does not seem to be loaded.

Where is my mistake here?

Thank you,
Chris.

I think the issue is with using relative URLs. If you use a relative URL without a slash in front (like css/main.css), the URL will be resolved relative to the directory of the current page. So your browser is likely trying to load http://www.yoga-kids.net/livres/css/main.css

How to fix that? Simple: put a slash in front of the URL (like /css/main.css). That way, the URL will be linked to the root of the domain name, regardless of which directory you are currently viewing.

Hello Admin,
Thank you for your answer.
I updated all the relative path with / in front. But it does not change anything.
When I have a look at the “page source” of “http://www.yoga-kids.net/livres” from my browser, it displays a source code with frameset which is not my code, but added by
Infinityfree (?):

<html>
<head>
<title>www.yoga-kids.net</title>
</head>

<frameset>
    <frame src="http://yoga-enfant.epizy.com/livres" name="redir">

    <noframes>
      <p>Original location:
        <a href="http://yoga-enfant.epizy.com/livres">http://yoga-enfant.epizy.com/livres</a>
      </p>
    </noframes>
</frameset>

</html>

I guess my problems comes from there.
Would it be possible to remove that frameset redicrection?

Thank you,
Chris.

@ChrisL said:
Hello Admin,
Thank you for your answer.
I updated all the relative path with / in front. But it does not change anything.
When I have a look at the “page source” of “http://www.yoga-kids.net/livres” from my browser, it displays a source code with frameset which is not my code, but added by
Infinityfree (?):

<html>
<head>
<title>www.yoga-kids.net</title>
</head>

<frameset>
    <frame src="http://yoga-enfant.epizy.com/livres" name="redir">

    <noframes>
      <p>Original location:
        <a href="http://yoga-enfant.epizy.com/livres">http://yoga-enfant.epizy.com/livres</a>
      </p>
    </noframes>
</frameset>

</html>

I guess my problems comes from there.
Would it be possible to remove that frameset redicrection?

Thank you,
Chris.

I checked your website again and I think I overlooked something before.

Your website page uploaded here has the following HTML attribute at the top of the file:

<base href = "http://www.yoga-kids.net/">

What this does is change the logic of the relative URLs. So /css/main.css doesn’t go to http://www.yoga-enfant.epizy.com/css/main.css, but to http://www.yoga-kids.net/css/main.css instead. And since http://www.yoga-kids.net/css/main.css is not a CSS file but a HTML (with the actual CSS text in a frame), the styles don’t work.

There are two ways to solve this:

  • All the asset links in the page must have a full URL including domain name.
  • The base href attribute must be removed.

Hello Admin,

Thank you for your feedbacks.
So, I understand that due to Infinityfree frameset, there is a difference for any resource file (html, css, images…) between http://www.yoga-kids.net/ and http://www.yoga-enfant.epizy.com/. Right?
Therefore, it means that I cannot include in my html files any resource with http://www.yoga-kids.net/. Right?

Then it leads to another issue for me.
I did use that base href + .htaccess in another web hoster to have subdomains. I understand it will not work with Infinityfree.
My objective is t have a few sub-domain for www.yoga-kids.net, such as livres.yoga-kids.net, cours.yoga-kids.net, and formation.yoga-kids.net. These subdomains points to different folders: www.yoga-kids.net to root folder, livres.yoga-kids.net to livres folder…
Some css, images, and other resources are common to html (or php) files for these sub-domains, and located under the root domain (e.g www.yoga-kids.net/).

I understand that I cannot use base href to point (and use relative path) to these resources, right? Then, does it mean that I cannot specify www.yoga-kids.net// (even with absolute path)? But only yoga-enfant.epizy.com// (with absolute path)? Not very handy!

Cheers,
Chris.

Sorry, the (inferior sign) and (inferior sign) were removed in my lat paragraph.
You should read:
I understand that I cannot use base href to point (and use relative path) to these resources, right? Then, does it mean that I cannot specify:
www.yoga-kids.net/<folder>/<resource>
(even with absolute path)? But only:
yoga-enfant.epizy.com/<folder>/<resource>
(with absolute path)? Not very handy!

@ChrisL said:
Hello Admin,

Thank you for your feedbacks.
So, I understand that due to Infinityfree frameset, there is a difference for any resource file (html, css, images…) between http://www.yoga-kids.net/ and http://www.yoga-enfant.epizy.com/. Right?

Almost. The frameset is not configured by us, but by Gandi. And the frames are not the problem here, the base href tag is.

@ChrisL said:
Therefore, it means that I cannot include in my html files any resource with http://www.yoga-kids.net/. Right?

Exactly.

@ChrisL said:
Then it leads to another issue for me.
I did use that base href + .htaccess in another web hoster to have subdomains. I understand it will not work with Infinityfree.
My objective is t have a few sub-domain for www.yoga-kids.net, such as livres.yoga-kids.net, cours.yoga-kids.net, and formation.yoga-kids.net. These subdomains points to different folders: www.yoga-kids.net to root folder, livres.yoga-kids.net to livres folder…
Some css, images, and other resources are common to html (or php) files for these sub-domains, and located under the root domain (e.g www.yoga-kids.net/).

I understand that I cannot use base href to point (and use relative path) to these resources, right? Then, does it mean that I cannot specify www.yoga-kids.net// (even with absolute path)? But only yoga-enfant.epizy.com// (with absolute path)? Not very handy!

Cheers,
Chris.

The main issue is that URL Forwarding/Masking using HTML frames (which is what Gandi did for yoga-kids.net) is a major limitation. You can’t completely hide the original subdomain, because URL Masking simply cannot allow you to do that.

If I were you, I would do the following:

  • Add yoga-kids.net as an addon domain to your hosting account here. That does involve changing your domain’s nameservers, but that’s quite straight forward.
  • Use the Subdomains menu to create livres.yoga-kids.net, cours.yoga-kids.net, etc. These subdomains will get their own directories with their own website.

The disadvantage of that setup is that you cannot show the same content on livres.yoga-kids.net and yoga-kids.net/livres/ (without manually uploading the same files to both folders). But beyond that, your website is completely white label and doesn’t use the free subdomain anymore.