Reputation: 23
I got a problem my email php file doesnt work if i put this .htaccess code in
## Prevent directory listings
Options All -Indexes
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
the function from sending an html file with a form to the php file doesn't work. the form works with post and then in the php file i have.
<?php
if(!isset($_POST["submit"]))
{
echo "error; you need to submit the form!";
}
$name = $_POST["name"];
$visitor_email = $_POST["visitor_email"];
$message = $_POST["message"];
this code no longer works then. i guested its because of rewriting the url with the .htaccess,
thanks for reading
Upvotes: 2
Views: 1579
Reputation: 785611
Insert this line just below RewriteBase
line to ignore your rewrite rules for POST requests:
RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^ - [L]
Upvotes: 2