I got this rewrite rule from the internet:
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
The rule works well, but now when I try to send a POST message, this rule will rewrite also the method to GET. This is my form:
<form action="check.php" method="post">
<input type="text" name="email" id="email"/>
<input type='submit' value='check'>
</form>
This is what I got from the server (var_dump($_SERVER))
["REQUEST_METHOD"]=>
string(3) "GET"
I am not really familiar with rewrite rules. Could you tell me how to fix it so that it still process php file extensions but wont touch the REQUEST_METHOD part (from POST to GET)?
Thank you.
UPDATE FULL RULE:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [L,NC] #[R,L,NC]
## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]