How to change your default Index page in htaccess

The server looks for specifically named files as the first page of your website, also known as the index page. The default order of index file names our particular servers look through is index.htm, index.html, index.php, and finally default.htm. You can change the name of the index file your account looks for by altering the .htaccess file. Perhaps you want to have a specific custom name for your index file or maybe you are migrating from another host and the index page is named differently. This way your internal links will not be broken by renaming the index file.

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

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.

Look for the .htaccess file and right click on it. This brings up a menu. Find and click on the Edit option.

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.

Thanks. I checked and all seems correct. Tried uploading Joomla also and still its not picking default page. So called the hosting support line and they admit that theres a fault at there end and they will fix it by eveving. Lets hope they fix it soon and then will try agin. Thanks for your replies.

Thank you for contacting us today. This guide allows you to set which file will load when someone visits your website. For example, you can set it to load any of the following files: index.php, index.html, index.htm

i have some problem that may be ralated to this issue, i have changed the Directory Index for magento store since 4 months and it was working very well tell yesterday because of some one of the store managers have did some changes to the website configuration and it now it gave me "There was no Home CMS page configured or found." and i don't know what to do , i searched many time so please if you can help as my experience with Magento is something little.

If your settings are correct and they're not working when they once were, then you may need to contact Magento support for further assistance. It appears as the issue is more Magento oriented at this point and this may be something that they are required to address. Apologies that we cannot provide you a direct answer at this point.

I'musingprestashop. I've cleared the cache, but theresult remains the same.

formy.htaccess i set permissions 777, is thiswrong? there is also aconfusingme, Iusetwolanguages, butwhywhenIchangedthe language, the products IchangeinIndonesiandid notchangeinEnglish? www.indoislamicpedia.complease helpregards,Ardhi

We're not sure what you're asking, because once you have WordPress installed, the first thing that appears when you type your website URL, is the home page. Your internet browser goes to the page that you set it to go. If you're trying to make the WordPress site your home page, then you need to set your browser settings to do that. WordPress also has an Administrator login page. That is not the first page of the actual website - just checking to make sure that you are aware of this. If you can please explain exactly what you're trying to do, then we can try to provide further assistance.

I am not happy with search results for my website's homepage. My website is built in magento and when i search for "raw audio brand" in Google. My search result for homepage appears as "raw audio raw audio" twice a time. I don't like this. Even my homepage title is different.

Sorry for the problem with the search result. You can (and should) take the issue up directly with Google using Google's WebMaster tools. You should also look at the search terms and any text being used to describe your site. It would also help if you provided information on your website such as the URL and how you built it. Please provide us a little more information and we can look into the issue further.

It appears you are using IIS and ASP for your site. This article is for APache web servers. IIS does not have a .htaccess file. It uses a file named web.config. It will have its own format for changing the default index page.

I'm doing SEO for a website. I want to redirect all old URLs to new URLs but all old URLs going to the home page. The guy who did the new website added htaccess coding. I can see two htaccess files in the server. One file is htaccess and second file is htaccess- Website is not working if I deleted one of them.

I Know 301 permanent URL redirect but when I put them they just go to the home page. Please help me. Tell me should I do. Thank you very much. This website is manual coding cms system. There are another two htacess files in "system" and "application" folder but when I open it says "Deny from all" I'm asking this same question since 2 weeks ago on other forums but no one helps. Please help

The .htaccess is a hidden file. If you're using the cPanel File Manager and you have not set it to view hidden files, then you will not see the .htaccess file. You can reset the File Manager settings by logging into cPanel and then going to the bottom of the screen and selecting "reset all interface settings". Then when you go into the file manager, make sure to click on "Show Hidden Files". This will let you see the .htaccess file. If you created an .htaccess file previously, remember that case (no capital letters) and the period at the front of the file name are required for this file to operate correctly.

I hope this helps to answer your question, please let us know if you require any further assistance.
Regards,
Arnel C.

Is the server you are using online a WAMP server as well? This may not work if you try uploading content directly from WAMP to linux or windows servers. Can you provide the error that you are getting so we may try to troubleshoot further.

I am hoping to set up a Prestashop site with inmotion but I want visitors directed to a custom "coming soon" teamplate that I purchased separately. It is NOT a prestashop plugin but a standalone template with separate css, js, etc. files. My concern is that some of these files and folders may be named the same in Prestashop and I would assume that will create problems. Is it possible to place all of the coming soon files and folders in a separate folder and use the htaccess file to access the index.html within that folder so visitors will be directed to my coming soon page while I get my Prestashop site completed? Or...is there some other approach I should take? I've worked hard to set up the coming soon page just the way I want and I don't want to have to abandon it.

There is no way to do this in PrestaShop natively, however if you have PrestaShop located in a folder called /shop then you could have an index page that when clicked (or what ever the action you want to be) it redirects to mydomain.com/shop.

With all the different types of ideas out there about how to redesign and relaunch an old html or shtml site as a new wordpress site (for example) without having to move files and worry about relative file structure and SEO, changing root folder file priorities seems the simplest.

Why not just prioritize the old index file (in my case index.shtml for many older sites) and build the WP site in the same root directory. The domain name will call the old index.shtml and no one will see index.php while you are working on the new site unless they type in index.php. Meanwhile both versions of site exists the whole time in root directory. Then when ready to relaunch, do your 301 redirects and then alter htaccess back to default (or just remove) and all pages will still exist but domain URL will now call the new site index.php. No big transfer of files.

I guess the only question is how to do it best:

This might be one way: https://documentation.cpanel.net/display/ALD/DirectoryIndex+Priority

But your .htaccess mod may be easier, and doesn't require a reboot. Am I missing something here? The other recommendations I've heard and read about with moving files from a local machine to web or from folder to folder seem much more precarious.

The workaround to this is just to set the WP "site URL" to http://domain.com/index.php in general settings. Then set it back to just the domain and deprioritize the html index priority in .htaccess to launch.

I'm sorry to hear about the problem you're having with your website. We would need a little more information on the issue in order help you. Can you provide a URL? Any error messages? Steps to duplicate the problem? Please provide some information and we would be happy to investigate the issue further.

Sorry for the problem with the .htaccess code. Do you get any errors? What's happening when you try the code? I have asked TJ to review the code for you and he should reply with some further information. Check out this tutorial on query redirects for .htaccess. It may help you resolve the issue as well.

If i want the first page to acces to be a file in a folder like: eng/home.php what should i do? When i set the sefault page to eng/home.php it works fine but when i click on the menu the path is not IN that folder. For example i go to the defaut page which is eng/home.php an then when i navigate to e.g eng/info.php it gows to info.php and as a result the page does not exists.

I am not using cms the website is pure code. I am askingif there is a way to set for defaulte page in .htaccess a file that is inside a folder and 'stay' there so i can navigate to files inside that folder without using href="../........" but using href="......."

The instructions above tell you how to use DirectoryIndex to specify a DIFFERENT name for your index file. So, if it's named home.php, then you can specify that file as your index file by using the directoryindex command in the .htaccess file.

Erin, you may need to place your .htaccess file in a different directory than the one that it is currently in based on your domain's document root if you're not seeing the code operate as you've expected. I recommend contacting your web host's Support for account specific assistance, if possible.