Joomla

How to Redirect Index.php to Homepage in Joomla?

If you are using Joomla as your CMS (Content Management System), one of the common mistakes is using /index.php in website logo. This...

Written by Deepanshu Gahlaut · 1 min read >
How to Redirect Index.php to Homepage in Joomla

If you are using Joomla as your CMS (Content Management System), one of the common mistakes is using /index.php in website logo. This creates a new URL www.example.com/index.php which actually show the same content as on home page www.example.com.

Both URLs would be seen by Google as two separate and distinct pages, thus duplicate content problem arises. This can impact your site search visibility and user experience to a great extent.

Possible URLs that can create the duplicate page content problem:

These are the possible URLs that can create the duplicate content problem:

example.com
example.com/
www.example.com
www.example.com/
example.com/index.html
example.com/home.asp
example.com/home.html

Related Post: Steps To Properly 301 Your Domains

Let’s see how you can redirect index.php version to your root domain or to your home page in Joomla and remove the duplicate content problem.

1. Canonicalize the pages

When Google finds these all different URLs that actually point to the same home page, Google picks and canonicalize the URL that seems best from this set of URLs.

But this decision is much dependent on the internal linking as well, how many links you point to example.com/index.php or www.example.com across your entire site.

However, it still creates the duplicate content URL problem. In order to remove this problem and make sure that Google picks the URL that you want, you should use rel=canonical tag. Just Add the following HTML to the <head> section of these pages:

<link href=’http://www.example.com’ rel=canonical’ />

This will set the http://www.example.com as the preferred URL and will indicate the search engines to follow it.

(This process is called canonicalization that picks the best URL when there are multiple choice or URLs.)

2. Make use of 301 Redirect

Another method to solve this problem is to use 301 redirect. It permanently redirects the pages to a single destination URL.

To make a 301 redirect to homepage from /index.php using .htaccess in Joomla, use the code: 

# Redirect index.php to Root
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^index\.php$ http%2://yoursite.com/ [R=301,L]

To make 301 redirect to subdomain homepage, for example you want to redirect xyz.example.com/index.php to xyz.example.com use the following code in Joomla .htaccess file:

RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

Note: make sure to backup .htaccess file before making any changes.

Have you any experience with this problem or know any other method to make the redirection, not listed here? Please share in comments.

Written by Deepanshu Gahlaut
I write on SEO, content marketing, latest technologies, and social media. You can find me online, or at home watching sci-fi movies, listening songs, or sleeping. In addition, my latest obsession is creating, collecting and organizing visual content on my new blog - Infopixi, to help bloggers, marketers, and businesses. Profile

Leave a Reply

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