Why Homepage is “index.php?option=com_frontpage&Itemid=1″?
Tags: joomla, seo, com_frontpage
The question why Homepage is accessible to addresses http://site.com/ and http://site.com/index.php?option=com_frontpage&Itemid=1 arises on a regular basis. More precisely, there is a question “How to get rid of it?”
I know at least two solutions of this problem.
The first solution does not demand modification in Joomla! files. It is necessary to not publish the module “mainmenu”, and to publish other menu (”reserves”) in which the first item will be simple url of a site. An essence of this method that the Homepage (http://site.com/) is first item in the menu “mainmenu” and it is not dependent on that, the corresponding module of this menu is published or not (therefore in the menu “mainmenu” it is possible to leave in general only this first item).
The second solution more simple, but demands modification (hack) in a Joomla! core. It is necessary to change function “sefRelToAbs” in a file “/includes/sef.php” so that the link “index.php?option=com_frontpage&Itemid=1″ was replaced on “/”. For this purpose it is enough to add in the beginning of this function (approximately 390-th line) the following code:
if($string=='index.php?option=com_frontpage&Itemid=1') $string='index.php';
As a result it should turn out here that:
function sefRelToAbs( $string ) { global $mosConfig_live_site, $mosConfig_sef, $mosConfig_multilingual_support; global $iso_client_lang; // INSERT CODE HERE: START if($string=='index.php?option=com_frontpage&Itemid=1') $string='index.php'; // INSERT CODE HERE: END //multilingual code url support if( $mosConfig_sef && $mosConfig_multilingual_support && $string!='index.php' && !eregi("^(([^:/?#]+):)",$string) && !strcasecmp(substr($string,0,9),'index.php') && !eregi('lang=', $string) ) { $string .= '&lang='. $iso_client_lang; }
NOTE: If your Homepage (first item in the “mainmenu” menu) is not “index.php?option=com_frontpage&Itemid=1″, then you have to change this code for your own needs (i.e. write your link instead of “index.php?option=com_frontpage&Itemid=1″).
June 11th, 2007 at 3:32 am
Hi,
I have to give one word of warning though - implementing this and/or the relative links hack kills off the ability of presenting your site’s RSS feeds properly (as it removes the www.domain.com from the generated links).
I found out this issue by accident, when my FeedBurner feeds stopped working all of a sudden, and removing the hacks solved my problem again.
Thought I’d let you folks know.
Regards,
Anthony
June 11th, 2007 at 3:56 am
Probably, the problem is due to relative links in rss feed. Try to solve it by replacing codes from How to make relative links on the pages post to (in the case of standard component for rss export)
and
respectively.