开发者

.htaccess - How to hide the internal directory used by subdomains?

I installed a small FTP space for my classmates which allows them to upload school related documents to my server. After the files have been uploaded, they can be easily accessed via a subdomain i.e. ftp.mydomain.com

Everything is working fine, the files can be downloaded and everything works properly. There are two th开发者_StackOverflow中文版ings which still annoy me though:

  • If you enter ftp.mydomain.com you see Index of /my_internal_directory instead of something like Index of /
  • Once you enter a sub-directory and click the Parent Directory link it will redirect you to ftp.mydomain.com/my_internal_directory/ as well

Is there any way to hide my_internal_directory ?

This is the content of my .htaccess file so far:

RewriteEngine on
RewriteCond %{HTTP_HOST} ftp\.mydomain\.com
RewriteCond %{REQUEST_URI} !^/my_internal_directory/
RewriteRule ^(.*)$ /my_internal_directory/$1 [L]

Any help would be greatly appreciated.


If you are using linux server then you can remove read permission for folder my_internal_directory

If not resolve, try to add: Options -Indexes on top of the file.

If still doesnt resolve please post your .htaccess file... :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜