CodeIgniter Forums
How To Prevent Duplicate Content - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How To Prevent Duplicate Content (/showthread.php?tid=53960)



How To Prevent Duplicate Content - El Forum - 08-16-2012

[eluser]Unknown[/eluser]
How To Prevent Duplicate Content?

Example:

http://codeigniter.com/index.php

no redirect to:

http://codeigniter.com/

My .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#remove www. from the uri and redirect with a 301 code.
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

#rewrite uri if its not a file to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php/$1

</IfModule>







How To Prevent Duplicate Content - El Forum - 08-16-2012

[eluser]Clooner[/eluser]
There are many ways to work with duplicate content. Canonical URLs is also way to go. But the domain.tld and domain.tld/index.php google will handle that just fine and there is not a need to worry about that!


How To Prevent Duplicate Content - El Forum - 08-16-2012

[eluser]CroNiX[/eluser]
index pages (index.php, index.html) don't count as duplicate

If the same content showed up for
www.yoursite.com/some/url
and
www.yoursite.com/some/other/url
AND you had links to both urls, then you'd get penalized.