I read quite a lot of htaccess reviews, but it still confuses me so much. I have the following rule in my .htaccess file, basically removing the .php extension from the files and resolving the URL without the extension:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://www.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://www.example.com/$1 [R=301,L]
RewriteRule ^([^/.]+)$ $1.php [L]
However, when I want to contact, for example, contact_form.php (which handles the processing of form data from a form in HTML), it is written to contact_form and all POST data is lost. I would like to achieve this when the request contains data for publication, the URL should not be redirected / rewritten. I honestly have no idea what a rewrite rule should look like. All help is much appreciated!
source
share