Same site, different domain, strange behaviour

I have the same website uploaded with free infinityfree host:

  1. with a free epizy domain: https://farmeasy.epizy.com/speech_2_dymo/index.html
    and
  2. with a paid cc domain: https://www.speaklabel.cc/

The issue

Although the website files are completely the same in both hosting accounts, the site appearance is very different, and i can see that the second link give me this error:

“Access to XMLHttpRequest at ‘https://infinityfree.net/errors/404/’ (redirected from ‘https://www.speaklabel.cc/jquery.hotkeys.js?_=1657498117611’) from origin ‘https://www.speaklabel.cc’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: Redirect is not allowed for a preflight request.”

Is there any free host with paid domain limitation? Or else i can not find any logical explanation for this.

Make sure that jquery.hotkeys.js was actually uploaded.

2 Likes

Yes it is. I rechecked. Although the problem is not limited to the hotkeys anyway.

It is obviously not there if it is returning a 404 error.
Please try uploading it again.

All of the files listed on the right are not present on the server.

5 Likes

its strange, as i can see all these files in the File Manager.
Also, i tried to delete and reupload VisitorManagement.js and it still gets a 404.
And i have already tried to reupload everything in the past.

Is it a parked domain or an addon domain?

2 Likes

The files are indeed the same, but the URLs you are using are different.

On the free subdomain, you are accessing the index.html file in the speech_2_dymo folder. And in the HTML code, the URLs are all relative to the current folder, so the URL to a file looks like https://farmeasy.epizy.com/speech_2_dymo/jquery.hotkeys.js?_=1657551125747.

On the custom domain, you are accessing the page as https://www.speaklabel.cc/. So the final URLs look like https://www.speaklabel.cc/assets/vendor/popper/popper.min.js.

However, like with the free subdomain, all the website files are located in the speech_2_dymo folder, not the main htdocs folder, which is why the files cannot be found.

There are roughly two ways to fix this:

  • Simply move all the files from the speech_2_dymo folder to the main htdocs folder.
  • Setup .htaccess rules to remap all (non-existent) URLs in the main folder to the speech_2_dymo folder.
6 Likes

First of all thank you for the quick and detailed response.
Solution 1 worked just fine.

Although, i cannot still understand why i had this folders conflict, as i always use relative links and not “hardcoded” full links e.g. I dont use https://farmeasy.epizy.com/speech_2_dymo/jquery.hotkeys.js?_=1657551125747 but /jquery.hotkeys.js or something like that.

1 Like

How you format the links makes a huge difference on how the browser interprets them. So it’s very useful to understand the different ways to write URLs and how they are handled by browsers.

It’s not really a “conflict”. The file you’re trying to use is located at https://www.speaklabel.cc/speech_2_dymo/jquery.hotkeys.js. So on the HTML page, you need to place a URL that ultimately goes to that specific URL.

If you then use the URL which is just jquery.hotkeys.js, the browser will understand this URL as being relative to the current directory. So on https://farmeasy.epizy.com/speech_2_dymo/index.html, this becomes https://farmeasy.epizy.com/speech_2_dymo/jquery.hotkeys.js, which is good. But on https://www.speaklabel.cc/index.html, this becomes https://www.speaklabel.cc/jquery.hotkeys.js. And that’s a different URL, which is why it doesn’t work.

To serve a file on a website, you need to tell the server exactly where to find it. You can’t just give it a file name and it will just kinda search your account for a file somewhere in some folder that might be the one you’re looking for. That search operation is theoretically possible, but would be extremely slow at scale, but it’s generally quite easy to fix through code.

7 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.