• How to Change your Default Index Page in htaccess

    What is an htacces File?

    The .htaccess file is a hidden text file within your hosting account that can be very powerful. It is designed so that you can modify it to change the behavior of your website that normally would take higher access beyond your account. It acts as a liaison between your domain and the server and can perform many functions.
    Learn more about htaccess

    Changing your Default Index File Via htaccess

    1. Log into your cPanel
    2. Find the Files category and click on the File Manager icon.
      cpanel
    3. Click Settings at the top right corner.
    4. cpanel
    5. Select the document root for the domain you are working with and be sure the checkbox next to Show Hidden Files is checked. Click the Save button.
      file-manager-show-hidden
    6. Look for the .htaccess file and right click on it. This brings up a menu. Find and click on the Edit option.
      file-manager-htaccess
    7. You may be presented with a popup. Click on the Edit button. file-manager-htaccess
    8. You are now in the htaccess editor. Paste the following code at the top of the page to configure your desired index page. In our example below, we decided to make the index page of our folders named first.html.
      #Alternate default index page
      DirectoryIndex first.html
      You can also list more than one file in the configuration. The file will be read left to right and check for them in that order. In this example, we add index.htm, index.html, and index.php to the list. First the server will check for first.html, if it does not find a file with that name, it continues to index.htm and so on.
      #Alternate default index pages
      DirectoryIndex first.html index.htm index.html index.php
    9. Be sure to hit the Save Changes button in the upper right corner to save your new htaccess configuration.
  • 1 comment:

    1. Nice article, thank you for sharing the informative article. I have also an article about htaccess
      . Thank you!!!

      ReplyDelete

    FAVOURITE LINE

    To steal ideas from one is plagiarism. To steal from many is Research.

    ADDRESS

    Mumbai , Maharashtra

    EMAIL

    shikha.pathak6@gmail.com
    shikha.the.swt.pari@gmail.com

    Skype

    shikha_pari