开发者

Codeigniter and html file protection (htaccess?)

开发者 https://www.devze.com 2023-01-31 01:40 出处:网络
I have created a small codeigniter application. one of the pages that needs to be protect is a fl开发者_JS百科ash page produced by some software which creates a series of other files (images, xml etc)

I have created a small codeigniter application. one of the pages that needs to be protect is a fl开发者_JS百科ash page produced by some software which creates a series of other files (images, xml etc).

This file and its assets needs to be placed in a specific folder (.e.g /websiteroot/flash). Is it possible somehow to protect this file from direct access and only be available through a codeigniter page?


You can put this HTAccess code in the folder "flash":-

<Files ~ "\.(inc|sql|...other_extensions...)$">
  order allow,deny
  deny from all
</Files>

This defines access to a file by its extension. For example, forbidding web visitors to access files with the "inc" extension:-

<Files ~ "\.(inc)$">
  order allow,deny
  deny from all
</Files>

When writing these HTAccess codes, put this in a file named ".htaccess", and nobody will be able to view those files with extensions as mentioned in the above HTAccess code.

If, however, you want to deny all files inside this "flash" folder, then put the below code in your ".htaccess" file:-
deny from all

Hope it helps.

0

精彩评论

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