Any advice or tips on how to not show index.html in url?

Hi everyone,

I’m practicing my html/css on vscode. When ever I use the extension (Live Server), I can direct links without writing the index.html (example: ../billy_a_html/) and it would work.

But when I transfer the code to GitHub and deploy it, it does not work. It seems that it can’t find the index.html because I have not written (../billy_a_html/index.html).

Any ideas or explanation on why this happens or if there is a solution or is it just bad practicing on my part?

Thanks

-Edgar

This behavior depends on server configuration. For example, Apache typically has a “if no file is specified after a folder, look for an index.php file and if found return that. if there is no index.php file look for an index.html file and if found return that”. Alternatively (though much less common) the server may return a list of the files within the folder.

I’m not sure I understand what you mean by

AFAIK, GitHub is a code repository and not a server. If you are having problems with the files pulled from GitHub running on your server, then IMHO it would be better to configure the server rather than hard code file names into your URLs. But that is only my opinion and either way could work. It depends on whether or not you want “friendly” URLs (no file name required) to work.

1 Like

Thank you for your response, on GitHub there is an option to view the code stored in the repository as a deployment(You probably know that, I’m just bad with words :slight_smile: ) So when I went to view the site on GitHub, it could not find the files.

Do you know if there is a way to configure this on GitHub so that the url’s have no name(index.html) ?

I believe I found a solution:

Thanks for you time,

-Edgar

2 Likes

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