Redirecting index.php to root in Joomla 1.5


Its very important that the homepage of the website is accessible through one URL only. For example, a typical joomla site would be accessible by domainname.com, www.domainname.com, domainname.com/index.php and www.domainname.com/index.php. If you are using frontpage component on the homepage, you may have an additional URL for homepage.

This way, the power of backlinks and google PR is distributed across several URLs. This can be easily taken care of by using the following code in .htaccess file.

For redirecting /index.php to www.domainname.com:

Options +FollowSymLinks
DirectoryIndex index.php

RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.domainname.com/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


For redirecting domainname.com to www.domainname.com:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domainname.com [nc]
rewriterule ^(.*)$ http://www.domainname.com/$1 [r=301,nc]


Once you have done this, you can check the redirection using a fantastic redirect check tool I can across. This tool will provide all possible URLs for your homepage along with the response code. The response code of 200 which is an OK response should be returned by just one URL.

  • Joomla Beginner

    Thank you so much for this informative blog post. I was just wondering how to redirect index.php to root in Joomla 1.5…

  • http://www.puertoazul.net Pepe

    Hello,

    I think you also need to add

    RewriteCond %{REQUEST_URI} !^/administrator

    if not the administrator’s index.php would also be redirected and not work?

    many thanks

  • http://www.hirejoomlaexpert.com/ jamesrobert21

    Nice Blog! Joomla experts can be your ultimate guide for Joomla service or Joomla template related service.

  • http://www.hirejoomlaexpert.com/joomlaexpert.html aidenwilliams

    Joomla is generally used to develop several aspects of Joomla module development such as catalogue, e-commerce, estate agency, forum, project management, property rental, comments, news, reviews, calendar etc.

  • www.berkshireradio.org

    You ought to take part in a contest for one of the greatest blogs on the net.
    I’m going to highly recommend this blog!

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.