Route not match and open folder directory
Nex4T opened this issue · 2 comments
Hey @steampixel
I have a Route /app/
and a folder structur begin with /app/folder/.../
the problem is when i set a route with /app/
they will open the folder app and show all in the folder
he open everytime the folder structer if i have a route or not, thats not good
Hey,
first of all this is a common behavior. But you can change this. It has nothing to do with the PHP-Part of the router. This is a webserver configuration set in .htaccess-File.
Take a look at this lines:
# Deliver the folder or file directly if it exists on the server
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
As you can see there is a rule that will open the folder directly if it exists. Just disable the second line. This configuration can be important. This ensures that requests to *.js, *.css, or images are processed directly by Apache. Only if a file or folder is unknown the request will be redirected to the router. I don't know if the second line is important for this. Maybe if your assets are placed in a subfolder? But you can also create a new special RewriteCond for your folder, if you want. Please do a few experiments on the .htaccess file. I don't know a quick solution for your case.
You should also disable DirectoryListing for security reason! This is responsible for listing all files and folders if you request a folder on the webserver. This second problem is also independent form the Router. https://stackoverflow.com/questions/2530372/how-do-i-disable-directory-browsing
ahhh best thanks ;) can be closed