Home > Blockchain >  Index.html not accessed when opening website
Index.html not accessed when opening website

Time:03-04

I have a website, norway-yv.epizy.com. I use InfinityFree to host (I just want to use the website for practise and as a fun hobby project). They use filemanager.ai to manage my files. I have a vast system of files and folders (see below), and instead of having to upload every file and every folder I have made it so that everything is in the website folder. This way, I do not need to upload everything every time I change something in my local copy of the website. I want norway-yv.epizy.com to redirect to norway-yv.epizy.com/website/home.html, and have done this trough an index.html file. However, it only gives error 404.

My files

.htaccess

DirectoryIndex index.php index.html index.htm index2.html

ErrorDocument 403 https://infinityfree.net/errors/403/
ErrorDocument 404 https://infinityfree.net/errors/404/
ErrorDocument 500 https://infinityfree.net/errors/500/

I have configured http://norway-yv.epizy.com/website/myerrorpages/[errornum].html as error page path in InfinityFree control panel

htdocs (folder, automatically created)

index.html

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>norway-yv</title>
    </head>
    <body>
        <meta http-equiv="refresh" content="0; url=website/home.html">
    </body>
</html>

website (folder, manually created)

index.html

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>norway-yv</title>
    </head>
    <body>
        <meta http-equiv="refresh" content="0; url=home.html">
    </body>
</html>

home.html

<html lang="en">
    <head>
        <title>norway-yv | home</title>
        <link rel="icon" type="image/png" href="../files/icons/favicon.png">
        <link rel="stylesheet" href="style/normal.css">
    </head>

    <body>
        <header>
            <a href="home.html">
                <img  src="files/icons/favicon.png" alt="Logo" />
            </a>
        </header>
        <h1>This is the website of norway-yv</h1>
        <p>I'm sorry for the horrible look of my website, but it is the best I can do</p>
        <h2>About me</h2>
        <p>I am a hobby developer who likes programming in Python. I am a student in Norwegian upper secondary school, year 1.<br>
            Some of my best projects can be found <a href="projects.html" >here.</a><br>
            Feel free to contact me trough GitHub.</p>
        <h2>Contact</h2>
        <p>
            <a href="https://stackoverflow.com/users/17496608/norway-yv" >StackOverflow</a><br>
            <a href="https://github.com/norway-yv"> GitHub (via GitHub e-mail)</a><br>
        </p>
    </body>
</html>

projects.html

<html lang="en">
    <head>
        <title>norway-yv | projects</title>
        <link rel="icon" type="image/png" href="../files/icons/favicon.png">
        <link rel="stylesheet" href="style/normal.css">
    </head>

    <body>
        <header>
            <a href="home.html">
                <img  src="files/icons/favicon.png" alt="Logo" />
            </a>
        </header>
        <h1>My projects</h1>
        <p>I have made tons more than this, mainly for scientific and mathematic purposes, but these are some of the projects I am most proud of:</p>
        <h2>kode24-calculator</h2>
        <p>An ongoing project, where I try to calculate expected wage for Norwegian developers using many different parametres.<br>
            For more information, see <a href="projects/kode24-calculator.html"> here. </a></p>
        <h2>binary-calculator</h2>
        <p>A project that sort of is finished, but still has a long way to go. Currently, it can calculate the sum of two binary numbers up to 32 bit size and output it.<br>
            For more information, see <a href="projects/binary-calculator.html"> here. </a></p>
    </body>
</html>

My comments in the end

I have much more than this in my website, with several other folders. I can add them to the question if that is necessary. But I hope not.
The same problems do occur when previewing (using edge showing the local version). So it's more of a problem with my files than InfinityFree.

CodePudding user response:

Maybe it's not working because you are missing the <base> tag in your <head>. The base tag defines the base URL, from where relative URLS are redirected.

For more

  • Related