Website html structure

Hi I have just been told to have a look at a site and have notice that every page has its own folder and in each folder is the page which is just named index.html so am a little confused as I know the person done it so the url are clean but this cannot be good practice? I was told if you wanted a clean site then use the htaccess file to remove the extension
so with it being on a testing server before going live is it better to move all all the pages back to the root folder and just remove the extension using the htaccess file or keep it as it is?

Most servers are set up to default to index.* (be it .html or .php etc.). So doing this is very clean and straightforward. You can just point to the folder and the index.* will be loaded but won’t show in the URL. It’s a simpler way of doing things than trying to work with .htaccess etc. It’s up to you how you do it, though. Either way, this is a rather “static” way to do things. CMSs and other things like JS frameworks work differently, in a more dynamic way. But there’s nothing inherently wrong with doing things the old fashioned way. :slight_smile:

2 Likes

Thanks Ralphm

the site has alot of custom code so CMS are not really an option but I just never seen a site built like that that every page has a folder just seem very long winded

1 Like

I’ve seen it but a long time ago in 2003 when i started doing web work. I inherited a site with 400 individual pages. i was tasked with updating them, which was quite time consuming. I then learnt the new fangled ‘database driven’ way of doing it and made things a lot easier.

i think @ralphm summed it up quite nicely though. I’d just add though that this is prefectly fine for a very low amount of pages but as soon as you start wanting to change things regularly then it has a high overhead.

You don’t have to use a cms to manage pages more dynamically. A bit of server-side scripting can make managing multiple pages mush easier.

I have actually used that method with multiple directories, each with an index file. Though that was before I had a better understanding of htaccess. It does work, but I recall one of the drawbacks was dealing with relative paths in shared resources, as the homepage was at a different directory level to the other pages. It was nothing that could not be overcome, but…

There are infinite ways to manage and structure a site, the best may depend on the nature and quantity of content, but a lot comes down to preference.

1 Like

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