JoomlaWorks

Member Dashboard
  • Home
  • Extensions
    • Commercial
      • Frontpage Slideshow
      • K2 Plugin for sh404SEF
      • Simple Image Gallery Pro
      • SocialConnect
    • Free
      • K2
      • AllVideos
      • DISQUS Comments for Joomla!
      • IAKI (Import As K2 Image)
      • Quick Menu (for Joomla 4)
      • Simple Image Gallery
      • Simple RSS Feed Reader
    • Free On Github
      • Akismet for Kunena
      • Fill It Up
      • K2 Example Plugin
      • K2 Links for JCE
      • Rebuild K2 Image Cache (CLI utility for K2)
      • TinyLetter Subscribe
      • URL Normalizer
      • User Extended Fields for K2
  • Templates
    • Commercial Templates
      • Anagram
      • Archetype
      • BusinessOne
      • Ibento
      • Janaro
      • Kiji
      • Matchbox
      • nuMuzik
      • RadioWave
      • Toreda
    • Free Templates
      • nuModusVersus
      • Takai
  • Demos
    • Joomla Extension Demos
    • Joomla Template Demos
    • WordPress Plugin Demos
  • Labs
    • Web Apps
      • JSON 2 JSONP
      • Feed Reader (bookmarklet)
      • Device Info
  • Support
    • Documentation for Joomla Extensions
      • AllVideos
      • Frontpage Slideshow
      • Simple Image Gallery
      • Simple Image Gallery Pro
      • SocialConnect
    • Documentation for Joomla Templates
      • General Resources
        • Installation
        • Content
        • Customization
      • Commercial Templates
      • Free Templates
    • Get Help
      • Community Forum
        • Recent Topics
        • Categories
        • Create free account
      • Help Desk
      • Contact us by e-mail
      • Contact us on Facebook Messenger
      • Contact us on Twitter
  • About
    • Blog
    • Company
    • License & Terms of Service
    • Privacy Policy
  • My Account
02 03 2011
Written by  JoomlaWorks
Published in Blog
Tagged under
  • +joomla
  • +markup
  • +SEO
  • +tips
  • +mod_rewrite
  • +apache
  • +Google
  • +redirect
10 comments

Why you should avoid using /index.php in your site's logo

Why you should avoid using /index.php in your site's logo
A common error most people do when finishing up a webiste with Joomla is forgetting to change their site's logo link from e.g. domain.com/index.php to just domain.com.
This usually happens for one of the following reasons:
  • People add an index.html placeholder page in their site so the actual site is not visible while they're developing it.
  • People add something like Logo because they work on a development (aka local) server so they cannot add the actual domain
  • People just use the /index.php link cause this is probably what they read in some Joomla tutorial.

In reality, this is bad SEO-wise for your site. You see, Google assumes domain.com/ and domain.com/index.php are 2 different pages. So without knowing, you easily screw up your site's SEO potential with the most important search engine today...

So, don't forget to fix your site logo's link when you go live, as it's the most hit "home" button.

A better way to implement this is by using this short php code as your link:


<a href="/<?php echo $this->baseurl; ?>/" title="My site's homepage">Your logo</a>

The above code will always print the right path to your site's root, no matter if you're on a dev server or live.

Alternatively, you can add this in your .htaccess file (if you're using it of course):


# Redirect /index.php to / - will also clear /index.php/something to /something
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php(/[^\ ]*)?\ HTTP/
RewriteRule ^index\.php(/(.*))?$ /$2 [R=301,L]


Use the above code with caution as in some rare cases, it may break your site...

More .htaccess goodness here: http://snipt.net/fevangelou/custom-htaccess-rules-used-on-joomla-sites-we-build/


If you're feeling masochistic, you can always create a Google Analytics account and specifically tell Google that your site's root is index.php so it won't consider domain.com/ and domain.com/index.php as 2 different pages...

Read 344453 times Last modified on Friday, 03 April 2015 00:44

10 comments

  • Fotis Fotis 30 May 2015
    Comment Link

    @Manolis
    Your /index.php is probably generated by a piece of PHP on your template's index.php file and not printed as it is, in there. It's best to consult with your template provider for more.

  • Manou Allou Manou Allou 21 Apr 2015
    Comment Link

    Hi Fotis,
    Sorry for digging up such an old thread but I believe that you are closer to what I want from any other searches I've done for my issue.
    I have built a site in Joomla 2.5 two years ago (http://www.grant.gr) and I have done almost everything "by the book" regarding the removal of index.php from site URLs. The only thing I still found that redirects to index.php is the site's logo which is coded in the template to redirect to it using the following:



    The site has 2 languages (Greek & English) with the default language in Greek. How can I make the logo redirect to the homepage of the currently selected language?

    I hope I made myself clear.

    Thanks / Best regards,
    Manolis

  • qhosterbg qhosterbg 11 Mar 2011
    Comment Link


    This is really against SEO using /page.html etc. I am glad you have wrote about it so more people can read it and do not make this misatek on their web sites.

  • David David 04 Mar 2011
    Comment Link


    great tip Fotis.
    Thx

  • Fotis Evangelou Fotis Evangelou 04 Mar 2011
    Comment Link


    Check http://www.joomlaworks.gr/index.php?something" rel="nofollow">http://www.joomlaworks.gr/index.php?something - index.php is not stripped ;) If you post to index.php or / it's the same thing, provided you properly redirect the root of your site to index.php using DirectoryIndex ;)

  • nikosdion nikosdion 04 Mar 2011
    Comment Link


    Beware with your .htaccess code, there is an unforeseen repercussion! Some modules will try to POST a form to http://www.yoursite.com/index.php" rel="nofollow">http://www.yoursite.com/index.php. Your code causes a 301 redirect to occur. In theory, the server should not issue the redirect for non-GET requests, but experience tells me that the usually do (haven't figured out why...). Moreover, when an AJAX module tries to GET an index.php URL, it is redrected. mooTools 1.11/1.12 doesn't like the redirection and returns an error. I have this issue with identical code added by Admin Tools Professional's .htaccess Maker and RocketTheme Gantry's AJAX powered login module. Maybe the best solution is to create a system plugin which "reads" the URL and forwards it with a 301 code if and only if the request method is HEAD or GET, effectively simulating the standardized 301 redirection mode of operation.

  • Pikpoq Pikpoq 03 Mar 2011
    Comment Link


    @k2joom you mean... like that? -> https://gist.github.com/852971" rel="nofollow">https://gist.github.com/852971

  • Fotis Evangelou Fotis Evangelou 02 Mar 2011
    Comment Link


    Use http://gist.github.com/" rel="nofollow">http://gist.github.com/ to paste code back in the comments by simply entering the gist snippet URL... Looks like something's missing from your last comment Simon ;)

  • k2joom k2joom 02 Mar 2011
    Comment Link


    In addition the the example code listed above, you could use:
    <?php echo $siteName; ?>
    This will pull the Site Name and use it for the title instead of manually coding, great little snippet to save.

  • k2joom k2joom 02 Mar 2011
    Comment Link


    Thanks for another great tip Fotis.
    Unfortunately some of the major template providers dont quite follow the same rules and actually force logo to append index.php.

    I am in the process to check my live sites and monitor analytics.

    Thanks again.


Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

back to top
BY MAIL BY RSS

Archives

  • March 2023 (1)
  • January 2022 (1)
  • July 2021 (2)
  • May 2021 (1)
  • February 2021 (1)
  • December 2020 (1)
  • September 2020 (1)
  • June 2020 (1)
  • May 2020 (1)
  • February 2020 (1)
  • January 2020 (5)
  • December 2019 (2)

Tag Cloud

allvideos announcement apache community development frontpage slideshow joomla k2 Performance plugin release sh404sef simple image gallery simple image gallery pro simple rss feed reader socialconnect ssh tips update video

Latest Entries

  • New free extension release: Quick Menu (for Joomla 4)
    Written by  JoomlaWorks
    06 Mar 2023
  • Simple Image Gallery (free) v4.2 released
    Written by  JoomlaWorks
    07 Jan 2022
  • Simple Image Gallery Pro v3.9.1 released (bug-fix release)
    Written by  JoomlaWorks
    26 Jul 2021
  • Simple Image Gallery Pro v3.9.0 released
    Written by  JoomlaWorks
    05 Jul 2021
  • Simple RSS Feed Reader v3.9.0 released
    Written by  JoomlaWorks
    25 May 2021

Join Our Newsletter

Enter your e-mail address to subscribe to our new or updated product notifications. We send combined newsletters, so we won't spam you every week :)

Get Social

  • Twitter
  • GitHub
  • Facebook
  • GitHub (K2)
  • YouTube
  • Speaker Deck

Grab Our Feeds

  • Extension Updates
  • Blog
  • Videos
  • Presentations
Copyright © 2006 - 2023 JoomlaWorks Ltd.
JoomlaWorks Ltd. and this site is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.
designed by Nuevvo