1

For the purpose of this question, I would like to highlight the following URL: https://www.therange.co.uk/occasions/birthdays/

Upon selection, you will be successfully directed to a page displaying 'Birthday Gifts'. Something, you would probably expect; based on the URL.

Now remove '/birthdays/' and press enter. You will be taken to a variant of the 404.php page. I have come across this, quite often. Where a URL will be working fine but if you 'go up a directory', you will land on an 'error page'.

Firstly, why do websites not resolve this? Is this some kind of strategy, which I do not see here?

Secondly, how is the page to the right of the 'error page' still able to load, if the 'parent page' is non existent? I do not know if I am just used to Content Management Systems, such as WordPress, but shouldn't a URL be redirected, if the 'parent page' is non existent?

Speaking more broadly, couldn't this undermine SEO efforts; based on user experience? I would assume, this URL structure could result in a 'broken' breadcrumbs. Furthermore, isn't a visitor's ability to navigate via the URL directly also considered a positive user experience; albeit small weighting?

2

If a webmaster isn't using an index file in a directory, a person visiting that directory url will see all of the folders and files in that directory.

To protect the code of a website, a webmaster should almost always be adding this to their htaccess file:

Options -Indexes

The above code prevents people from seeing the contents inside of a directory.

If the webmaster doesnt have an index.php or index.html file inside of that directory, and has indexes turned off with the above code then this may return a 404 error depending on how his server is setup.

You can change your own DirectoryIndex setting to be anything you like using an .htaccess file. If the server cannot find an index file, it tries to display an index of all the files within the current directory; however if this is disabled, the server ends up displaying a 404 forbidden error. Source: https://help.dreamhost.com/hc/en-us/articles/215747718-How-can-I-control-my-directory-indexes-with-an-htaccess-file-

You can also read more about this 404 error on directories here: https://serverfault.com/questions/331127/apache-options-indexes-give-me-404-instead-of-403-why/331144


Ideally, it is probably preferable not to return a 404 on a directory URL. A 301 redirect or an index.html might be best. But if the webmaster isn't linking to that directory, he probably assumes that very few people will actually try and visit that URL and so it's reasonable for him to work on coding other things that may be more important. It's simply more a matter of time than anything. But yes, a 404 is probably not the best result for the directory URL.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.