Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Index showing in home page link

edited April 2013 in Framework

Is there a way to eliminate the /index/ from the home page of a site?


  • You could add a bootstrap.php file to the root of the site and do it like this:

    if (preg_match ('|^/index/?$|', $_SERVER['REQUEST_URI'])) {
        header ('Location: /');
  • I added it to the bootstrap but /index is still showing. I tried both with and without the slash.

  • Ah I see. That won't get rid of the /index in the link, but it will redirect it back to just /. The links are generated by the Link class, specifically this bit:

    You could patch that method with something like this (added as an elseif to the if(nested) block):

    } elseif ($id === 'index') {
        $id = '';

    I didn't test it, but let me know if that works.

  • Mainly concerned about these pages appearing as two pages to Google. Could it be modified with a rewrites rule?

  • I tested the change and it seems to work well. You can go grab it from Github and all links to /index will automatically just go to / now :)

  • What file do I specifically grab? Is there a place on Github to only grab recently updated files?

  • I updated the navigation app along with other updates. The navigation was blank so I went and checked it. All of the menu items had been moved back to the right column so I moved them back to the left column. The navigation didn't save and went back to the right column.

  • It sounds like your conf/navigation.json was overwritten, and that you might need to make sure it's writeable again after the update.

  • I got it straightened out. Thanks for your awesome support.

  • By the way the main reason I wanted it gone was because I was concerned about the home and index looking like duplicate content to Google. That is as well a concern of mine with the blog archives.

  • I'm not an SEO expert by any stretch, but from what I've read about content duplication it sounds like category or listing pages that duplicate the content of detailed post pages is something Google is able to deal with.

    Most of what I can find related to duplicate content deals with cross-site duplication, or alternate versions of a page and the rel="canonical" meta tag, but that doesn't pertain to listing pages since they would have to point to multiple canonical pages.

    I tried using Google Webmaster Tools to see if the Elefant blog has similar issues, since the full posts appear in the listing page too, but it seems fine as far as I can tell...

  • Alright. Thanks for the info. Is there a way at all to get a snippet of the content versus the entire post?

  • You would have to override the blog/index page like this and either add a custom 'summary' field, or you could take the body and split it into summary vs full post using an <hr /> tag in the body content. I've used that trick on a site before and it worked pretty well. Anything above the <hr /> was part of the summary, below was the rest of the post body.

Sign In or Register to comment.