Skip to content
Advertisement

How to protect ASSETS FOLDER in codeigniter

I just wanna protect my assets folder in client side. All of my files can access public. I wanna protect it. I have rules .htaccess like below, any wrong rules there?

JavaScript

Advertisement

Answer

You can do two things

  1. via .htaccess (Not Tested)
  2. via index.html

1. .htaccess

add .htaccess inside the assets folder

JavaScript

2. index.html

Create index.html file inside the directory and add this

JavaScript

Output

When some one access outside you get this on browser

Directory access is forbidden.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement