Jump to content

How do I hide trailing slash after my sub-folder that my controller is in?


Recommended Posts

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 by JenniferLawrence
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.