• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
directory access

[eluser]Tejas D[/eluser]

I had developed a website in codeigniter.

In that, I have images,js etc folders(any other folder that exist under my ci folder).

But I can access all those folder from url. For eg:

a) localhost://ci/images/
b) localhost://ci/js/

and it result in displaying the contents in that.

So, How to avoid this. By displaying message as 'Access Denied' or error message.

anyone suggest on this. Thanks in Advance:-)

If you're using apache: http://www.webmasterworld.com/forum92/4441.htm

Specifically, edit/create .htaccess file:

Options -Indexes

[eluser]Tejas D[/eluser]
Hi.. Mirge

Thanks.. Smile

I viewed that link you provided.

what I did is, I simply copied the index.html of application folder into images,js folder.

and again tested the url. This time it didnot displayed the content rather displayed the message of that index.html file.

However, when I tested application folder, the message is (eg : forbidden ... path of folder and under it apache ... )
and when I tested images folder having same index.html file , the message is displayed without( forbidden and apache..)

Did I implemented it correctly or did some mistake.

It would be better to use
Options -Indexes
if you're using apache, IMO.

[eluser]Tejas D[/eluser]
Hi.. Mirge

To be frank, I didnot get the Options -Indexes.

means I required to write (Options -Indexes) in my .htaccess file.
and did I need to remove those index.html file from images,js folders.

Confuse little bit.What to do, to use Options -Indexes.

Edit your .htaccess file, at the end add:

Options -Indexes

Then, remove your index.html files from images/ and js/

Then try to access (via web browser) images/ and js/ directories. You should get a "Forbidden" or similar error.

[eluser]Tejas D[/eluser]
Hi.. Mirge

Perfect.. Smile It works as you said.

I did the way you said above.

Can I display my default page instead of that text( Forbidden...).
Also I override 404, which shows my default my instead our normal page not found error.

Because of this, I want to show my default page, whenever user access images/ or js/ (etc) directories.

How can I achieve this.


[eluser]Tejas D[/eluser]
Hi.. Mirge

how to change the 403 error message.

If possible a default view can be shown or at least from the normal message I want to remove apache.... line from it.

Please suggest on this.(refer above post for more detail)

Use custom error pages. This is related to your web server and not to CodeIgniter.

[eluser]Tejas D[/eluser]

Hi... Mirge

Got it.

Thank you very much for solving the problem. Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.