index.php duplicate content.

After speaking with a SEO expert they told me to remove the index.php page or use a redirect 301 to the home page because it could hurt my google rankings because of duplicate content. I am not able to use the redirect as I am getting an "too many redirects"error. So how do I remove the index.php version of my home page?

View Replies: View Best Answer
mnakalay replied on at Permalink Reply
All C5 index.php does is calle concrete/dispatcher.php, that shouldn't create any SEO problem.
Did your SEO expert tell you how he thinks this file create a duplicate content problem?
frz replied on at Permalink Best Answer Reply
turn on pretty urls and this isn't an issue.
Rocketspark replied on at Permalink Reply
We had a similar issue where /index.php was accessible to the public and was a duplicate of our homepage. Pretty URLS wasn't enough..

Adding this above the Pretty URL rewrite fixed the issue. And still allows CMS functionality.

RewriteCond %{THE_REQUEST} ^index\.php$
RewriteRule ^index.php$http://%{HTTP_HOST}/ [R=301,L]
mesuva replied on at Permalink Reply
I think this can also be solved with a rel="canonical" tag, which could be added to the home page using the header extra content attribute.

With pretty URLs on, urls with index.php shouldn't be generated, but if some have snuck into Google's index, I believe the canonical link should help to indicate that they are duplicates and reduce indexing penalties.

The 301 redirect method I'm sure works too, but I thought I'd suggest a way that can be implemented via concrete's interface.
madesimplemedia replied on at Permalink Reply
Another nice move for SEO would be to add some code to automatically populate canonical urls on each page:

            $cPath = $c->getCollectionPath();
            $canonicalURL = BASE_URL;
            $canonicalURL.= DIR_REL;
            $canonicalURL.= URL_REWRITING?"":"/index.php";
            $canonicalURL.= $cPath;
            if(!(substr($cPath, strlen($cPath)-1, 1)=="/")) $canonicalURL .= "/";
            $pageIndentifierVars = array('keywords','fID','tag','productID');
            $canonicalVars = array();
            foreach($pageIndentifierVars as $var)
            if($_REQUEST[$var]) $canonicalVars[]= $var.'='.$_REQUEST[$var];
            if( count($canonicalVars) ) $canonicalURL.= '?' . join(',',$canonicalVars);
<link rel="canonical" href="<?= $canonicalURL ?>" />
cmscss replied on at Permalink Reply
Hey madesimplemedia,

I would love to more about this code you've posted for conical URLs - how does it work?

I'm just not sure what it's doing and how it works out the conical URL - it maybe that I'm confused about conical URLs.


mnakalay replied on at Permalink Reply
The numerous lines of code at the beginning are there to define what the canonical url is.

The last line prints a meta tag containing the said url for the benefit of search engine bots. The bot will read that tag and know what to do.

All this code needs to go somewhere in your theme code so it's inside each page's <head> tags

Most theme use a separate element for the header, usually simply called header.php or something like that, in a directory called elements most of the time. Those are in your theme's directory of course.