I had this url on my website example.com/foo.php
and I changed it to example.com/foo
by doing this in my htaccess:
RewriteRule ^foo$ foo.php [NC,L]
And it works fine. However I'd like to do a 301 redirect from the old url to the new url. So I added this line in my htaccess:
RewriteRule ^foo.php$ http://example.com/foo [L,NC,R=301]
And I get an infinite loop of redirects... How to fix that?