user1360280
user1360280

Reputation:

How to avoid Navigation of folders through URL manipulation

Please i need your help with my website (testing stage). I have a file system of this nature...

     www (root)  
  {

           school { //main project folder

                  images //images folder

                  uploads //user uploads folder 

                  JavaScripts //JS folder

                  CSS // css folder

                 includes //includes folder

             index.php

            contactus.php

            aboutus.php

            register.php

           } //main project folder
  } //www folder               

how can i prevent users from browsing through my folder system when they do somrthing like these:

 http://127.0.0.1/school/css
 http://127.0.0.1/school/images
 http://127.0.0.1/school/includes
 http://127.0.0.1/school/uploads
 http://127.0.0.1/school/javascripts

Thnaks for your help....

Upvotes: 0

Views: 2039

Answers (3)

JiNexus
JiNexus

Reputation: 2844

Create an .htaccess file to the directory you don't want to be navigated via url input..

and inside the file, put this line:

Deny from all

that's all.. enjoy..

and for security purposes use this lines instead:

Options -Indexes

Upvotes: 0

user1012032
user1012032

Reputation:

You could also put an empty php or html file called index.php or index.html in every folder. The users will be unable to browse those directories.

Upvotes: 2

Madara's Ghost
Madara's Ghost

Reputation: 174997

See the following article on how to disable direct directory browsing

Specifically, search for Options Indexes in your .htaccess file. If one does not exist, add the following line to your .htaccess:

Options -Indexes

Directory browsing should not be available.

More methods are available at the article above.

Upvotes: 2

Related Questions