Welcome Guest, Not a member yet? Register   Sign In
directory access
#1

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


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/
or
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:-)
#2

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

Specifically, edit/create .htaccess file:

Code:
Options -Indexes
#3

[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.


#4

[eluser]Mirge[/eluser]
It would be better to use
Code:
Options -Indexes
if you're using apache, IMO.
#5

[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.

#6

[eluser]Mirge[/eluser]
Edit your .htaccess file, at the end add:

Code:
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.
#7

[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.

Thanks
#8

[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)
#9

[eluser]Mirge[/eluser]
Use custom error pages. This is related to your web server and not to CodeIgniter.
#10

[eluser]Tejas D[/eluser]

Hi... Mirge


Got it.

Thank you very much for solving the problem. Smile


Cheers




Theme © iAndrew 2016 - Forum software by © MyBB