I have a joomla site and google has indexed domain.com/ and domain.com/index.php, so duplicate content for the home page. Is the best option to block index.php (not used my content URLs) in robots.txt, or redirect it to domain.com in .htaccess like: Redirect 301 /index.php http://domain.com/ If that will even work. Any suggestions?
You need to use the following rewrite code in your .htaccess to do this properly.... RewriteEngine On Options +FollowSymLinks RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9}\ /.*index\.php\ HTTP/ RewriteRule ^(.*)index\.php /$1 [R-301,L] Code (markup): Thats good to go as-is, just copy and paste and yout done.
Well, I tried redirecting the way I have above and got endless loop. Then I found this RewriteCond %{THE_REQUEST} /index\.php\ HTTP/ RewriteRule ^index\.php$ / [R=301,L] Now all 4 versions of the homepage are redirected to one. Thanks.
yep, redirection is the best way to do although you can use robots.txt to block index.php too. I am surprised joomla's robots.txt do not come up with this!