How to deal with extra URL path directories
On my website a user can navigate to one of the following URLs:
www.example.com/dir1/ #items list
www.example.com/dir1/item1/ #items' content
www.example.com/dir1/item2/row3/ #items' row content
whilst each of them is a valid URL, giving different valid results. Now let's say user navigates from another website with bad URL detecting RegEx or he tries to find some exploits or fails with typing valid URL and he gets one of the following link:
[1] www.example.com/item1/row2/
[2] www.example.com/dir1/row2/
[3] www.example.com/dir1/item2/.SomewordfrombadRegEx
[4] www.example.com/dir1/item2/row3/unsupportedLevel4/
[1]
URL will definitely lead to 404 Not Found
page. However, the rest have valid paths' parts in them. What should I do in this cases? Should I throw 404
error for [2]
, [3]
and [4]
URLs or just ignore invalid parts?