Sometimes you want a different opening page on your website from the default index.html that you normally get. Perhaps your Content Management System demands a different opening page or maybe you have put your website it a sub-directory. So how do you do this?
Using Redirect Will Harm our SEO Efforts
Well the most obvious option might be to use a redirect. That means anyone coming in on the root of the site would be redirected to the correct file of sub-directory. But this option comes at a price.
Rumour has it that using a redirect in your .htaccess will reduce your ranking position with Google by 10%. Sometimes you have no choice but to set a different page, or directory, as you home page on your website but by using redirect you are harming your SEO. So what other options do you have?
Use DirectoryIndex Instead
Well, you could use the DirectoryIndex command instead. This will then show the page that you specify when someone lands on your website. A perfect solution if you want to show a different file than the default index.html that Apache will select on the root of your webserver. Question is, how do you implement it?
How To Use DirectoryIndex
If you have been using redirects then turning to DirectoryIndex will be really easy for you.
The DirectoryIndex
directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the directory name. Local-url is the (%-encoded) URL of a document on the server relative to the requested directory; it is usually the name of a file in the directory. Several URLs may be given, in which case the server will return the first one that it finds. If none of the resources exist and the Indexes
option is set, the server will generate its own listing of the directory.
Example
DirectoryIndex index.php
Great For Joomla! Installs
If you have installed your Joomla! website in a sub-directory then this would work really well for you. You can force visitors coming in with your website address to see the correct opening page in the sub-directory without using the harmful redirect option.
Example
DirectoryIndex /properties/index.php
This will open the page in the sub-directory as the home page.
Did you find this article useful?
If you found this article helpful please take a moment to tweet, like, or share this article by using the buttons at the top of this page. I’d really appreciate it.
Also, if you are feeling extra generous after having your issue solved please leave some encouraging feedback in the comments section at the bottom of the page. I love getting feedback from visitors. It encourages me to find further solutions to those awkward little iPhone, iPad, MacBook, and Mac problems that we all suffer from.
Thanks for taking the time to read my website and I hope to help you again soon!
Leave a Reply