I'm very, very (very!) new to using mod rewrite...I have the following set in my htaccess and it works as expected to remove the .php extension. My question is how to also make the url be extensionless if someone puts any extension on the end of the url? Right now http://www.example.com/share etc all work, but so does http://www.example.com/share.php. I'd like to remove any extension on these pages!
Options +FollowSymlinks RewriteEngine on # remove php extension from all matching files RewriteRule ^(share|invite|submission|thankyou|confirm|over|report)$ $1.php [NC]
I've tried several things and it always ends up breaking both functionalities. For some reason this stuff is the most impossible thing to find quick google answers for. Thanks in advance!
UPDATE: Working in a way, but getting infinite redirect loop:
Options +FollowSymlinks RewriteEngine on # reslove extensionless urls RewriteRule ^(share|invite|submission|thankyou|confirm|over|report|emailtest)$ $1.php [NC] # make .php redirect to extensionless urls RewriteRule ^(share|invite|submission|thankyou|confirm|over|report).php$ /$1 [R=301,L,QSA]