JenniferLawrence Posted June 22, 2015 Share Posted June 22, 2015 (edited) Hello, how would I hide a specific directory and make it not accessable? I'm pretty sure it's not possible, but it doesn't hurt asking. So I have a controller that I don't want to be shown however, the controller is in a sub-directory that I want to hide. At the moment I'm using Options -Indexes Which only works if I don't want indexing where people can see what folders I have in that sub-folder. That's not what I want. So let's say the controller is put into the URL like so http://domain.com/this_is_my_controller Since this_is_my_controller is the sub-folder that the controller is in, I don't want it to do something like this. http://domain.com/this_is_my_controller/ It just tells the other person that the controller is within a folder which is bad. How would I be able to ignore the trailing forward slash and just make them think that the controller is an actual file itself and not a sub-folder? The reason why I'm doing this is because all the other controllers are in that sub-folder. It's important for me to separate controller files from random files. This keeps everything tidey if I have all controllers in its own sub-folder. EDIT: Never mind. I seem to have found the solution. Edited June 22, 2015 by JenniferLawrence Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 22, 2015 Share Posted June 22, 2015 You say you found the solution - but there are multiple solutions. My preference is to put any files that shouldn't be directly accessed outside of the public folders. Then you don't have to worry about folder permissions or putting logic into the files to prevent access. Quote Link to comment Share on other sites More sharing options...
JenniferLawrence Posted June 22, 2015 Author Share Posted June 22, 2015 Yes, there are many solutions. However, that wasn't what I was actually looking for. To go in depths, I have a presenter that controls all requests and sends it to the core file. With that in mind, since the controller can be requested through this method as well, it is a problem since if it is an actual directory, it will add an extra trailing slash to it making it tell the user that the request is an actual folder. That was the problem because all requests should not make it so obvious for the user. Therefore, I searched and searched and finally found the solution. It was the removal of trailing slash for directory redirection. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.