PHP, MySQL, Drupal, .htaccess, Robots.txt, Phponwebsites: Options
Options - phponwebsites.com
Showing posts with label Options. Show all posts

25 Nov 2013

How to enable or disable the directory lists using .htaccess

                      Your public_html folder should be contain many directories like images, js, styles. Someone may be try to access these files from your site without your permission. If you think, don't allow others to access these files, then you can create .htaccess file for protect your files from them.

Syntax:
               Options -Indexes
                    OR
                IndexIgnore *

           It tells the server to disable the directory listings on your site. Now you can not see your directory lists. If you try to get access it, then you will get forbidden error message.

You can also enable this features to your sire.
Syntax:
               Options +Indexes
           It tells the server to enable the directory listings on your site.


How to ignore the particular file based on its extensions in directory lists using .htaccess:


                        Normally when you access the directory list on your browser, you can get all files presented in that directory. Sometimes, you may be feel, other files will display to user except .php, .css, .js. you can done by .htaccess.

Syntax:
             IndexIgnore .*php .*css .*js

                       Now the user can get access your files except the file with extension php, js and css


How to display the directory lists with other details using .htaccess:


                      By default, the directory lists are displays just with only its name. If you want to know the additional details like its size, description, then you can done by .htaccess.

Syntax:
              Indexoptions +FancyIndexing
                 
                 Now you can get directory lists with additional information such as size, description, last modified date etc..

You can also disable the additional details.

Syntax:
              Indexoptions -FancyIndexing