Wednesday , 10 August 2022
Home > htaccess > Change the Default Directory Page

Change the Default Directory Page

Change the Default Directory Page – When you load a directory on the web, for example or, the apache server usually looks for the index.html file.

If it can’t find that it will look for index.php or index.cgi. Index.html is usually the page with the highest priority and the one which is loaded first.

It is possible to change the default directory index page. Say, for example, you wanted visitors to go to notice.html instead of index.html. All you have to add to your .htaccess file is

DirectoryIndex notice.html

This can be extended so that the server looks for other files if it cannot find the first one.

DirectoryIndex notice.html index.cgi index.php index.html

Priority goes from left to right. So the server would look for notice.html. If that file is not there it will look for index.cgi, then index.php and then index.html.

You can do to this within any directory on your site. Simply upload an .htaccess file with the above code. Remember, this will supercede the .htaccess file at the root of your domain.

About Whendy

Whendy Blog mengumpulkan beberapa Tutorial Website, PHP, AngularJS, JQuery, Laravel, Codeigniter dan lain-lain. ( jika sempat ) :)

Check Also

Htaccess Password Protect a Directory

Htaccess Password Protect a Directory is easy to do, all you have to do is ...

One comment

  1. If you would like to increase your knowledge simply keep visiting this web page and be updated with the most
    up-to-date news update posted here.

Leave a Reply

Your email address will not be published. Required fields are marked *