php - How to protect ASSETS FOLDER in codeigniter -


i wanna protect assets folder in client side. of files can access public. wanna protect it. have rules .htaccess below, wrong rules there?

rewriteengine on rewritecond $1 !^(index\.php|assets|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l,qsa] 

you can 2 things

  1. via .htaccess (not tested)
  2. via index.html

1. .htaccess

add .htaccess inside assets folder

<ifmodule authz_core_module>     require denied </ifmodule> <ifmodule !authz_core_module>     deny </ifmodule> 

2. index.html

create index.html file inside directory , add this

<!doctype html> <html> <head>     <title>403 forbidden</title> </head> <body>  <p>directory access forbidden.</p>  </body> </html> 

output

when 1 access outside on browser

directory access forbidden.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -