Apache filesystem and browser url paths


When someone requests a page e.g. page2, then I want to build a url string in the browser that looks like this “mypage.com/page2”.

However, problems arise if page2 is actually a folder. Apache will display the contents of the folder with its own interface.

How can I prevent it so I can build my own paths, without it messing with what apache does?

Best regards

Try adding this line to your .htaccess folder:

Options -Indexes

That will prevent directory listing in every folder beneath the root.

Google Search

1 Like

Hello John.

It works. Thank you, it’s really appreciated.

Do you know if there is a way to do something similar for all folders in the root? Otherwise I have to create a .htacess file for each folder that the user creates in the file system.

What I want to accomplish is to be able to use the directory path as a request string that the user can use, without apache interfering and returning its own page.

It apparently includes all subcategories as well. I put it in the root folder so now it works.

Thank you for your suggestion


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