URL Canonicalization to remove index.php

Hello! I have just set up a site and i'm in fear of a duplicate content penalty from google....

Whilst checking the SERPs i see the same articles from site listed with
        1) http://www.site.tld/index.php?L=articlename
AND 2) http://www.site.tld/?L=articlename
I would really like to remove the index.php from the URL using a rewrite rule in my .htacess file.

Here's a copy of the file so far:

DirectoryIndex index.php
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.tld [NC]
RewriteRule ^(.*)$ http://www.site.tld/$1 [L,R=301]
Options +FollowSymlinks
RewriteRule ^([a-z0-9]+)$ http://www.site.tld/?L=users.profile&id=$1 [r=301,nc]

Any help would be greatly appreciated :D
ogdiniAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BenMorelCommented:
Hi,
This should work.
Regards,
Ben
RewriteEngine On
RewriteBase /
RewriteRule ^((.*)/)?index\.php$ $2/ [QSA,R=301,L]

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ogdiniAuthor Commented:
mate! That works perfectly!!!!
Thank you :D

Post the exact same solution at
http://www.experts-exchange.com/Programming/Languages/Regular_Expressions/Q_23122248.html
where i offered 500 points for the question and you can get points x2

Thank you !
0
BenMorelCommented:
With a great pleasure, lol
Posted the answer, thank you !
Ben
0
ogdiniAuthor Commented:
Ben you;re a top man, that's really got me out of the s*it....howard at eyewitnessibiza dot {com please contact me if you are interested/free for some work
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Miscellaneous

From novice to tech pro — start learning today.