Title: PHP files in htdocs return 404 even though files exist

Website URL

http://learnspace.rf.gd

Error Message

Title: PHP files in htdocs return 404 even though files exist

Hello, my website is https://learnspace.rf.gd/

My “index.html” homepage loads when I visit the root domain, and “make_hash.php” also opens. However, “admin.php” and “index.html” return a 404 error when opened directly.

Other Information

I confirmed that “admin.php” is located at “/htdocs/admin.php”, alongside “index.html” and “config.php”. The files exist in the hosting File Manager.

Could you please help me identify why these files return 404?

Thank you.

Welcome to the InfinityFree community forum! Good to have you here.

  • Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
  • Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
  • AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
  • Solving an issue is a joint effort. Try the suggestions you get and report back what happened.

Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look.

Could you post the exact URLs that return 404, copied from the address bar, for admin.php and for index.html opened directly? Please also say whether there’s a .htaccess file in htdocs, and if so, paste what’s in it. Your post says index.html both loads and gives a 404, so I need to see which URL does which.

Since index.html and make_hash.php load, your domain is linked to the right folder. That points at something about those particular URLs or files, not the whole site. I found an article on what a 404 means on our hosting, and these are the causes in it that fit:

  • Exact name: File names are case sensitive, so Admin.php and admin.php are different files.
  • No htdocs in the URL: The URL should be /admin.php, not /htdocs/admin.php.
  • .htaccess rules: Rewrite rules can send some URLs to a 404 even though the file exists.

I can’t tell yet which of these it is, if any. The exact URLs and the .htaccess contents should narrow it down.

Thank you for your reply.

Here are the exact URLs:

  • https://learnspace.rf.gd/admin.php — returns 404.
  • https://learnspace.rf.gd/index.html — returns 404 when opened directly.
  • https://learnspace.rf.gd/ — the homepage loads.
  • https://learnspace.rf.gd/make_hash.php — opens successfully.

There is a .htaccess file inside htdocs. Its current contents are:

Options -Indexes
DirectoryIndex index.html index.php

<Files "data.json">
    Require all denied
</Files>

<Files "config.php">
    Require all denied
</Files>

The files admin.php and index.html are in /htdocs/, and their names are exactly as written above.

Could you please help me investigate why the direct URLs return 404?

Works for me

Try clearing your cache.

I cleared my browser cache, but the issue persists. https://learnspace.rf.gd/ loads the login page, and https://learnspace.rf.gd/make_hash.php works. However, /admin.php and /index.html still return 404. Could you please check whether this is a server-side caching or routing issue?

I checked your website and it seems to be working fine from here too.

We don’t have server side cache, and routing is controlled by your .htaccess configuration. Our browsers do enforce strong browser cache by default, but only on static files (including HTML files), not on PHP output. The index.html and home page behaving differently despite being the same file is consistent with browser caching too.

The URL https://learnspace.rf.gd/admin.php redirects me back to https://learnspace.rf.gd/index.html, and that URL also works for me.

One thing you should check: does the admin.php URL return the 404 error directly or does it redirect to the index.html file which returns the 404 error? What does the URL in the address bar say when you try to navigate to https://learnspace.rf.gd/admin.php?

Also, could you check your website in Incognito Mode and see if you get the same behavior there? That’s usually even more effective at circumventing cache than just clearing it, which has the tendency to not clear everything.