Mail.php不能与.htaccess一起工作


Mail.php doesn't work with .htaccess

我有一个问题,我的电子邮件php文件不工作,如果我把这个。htaccess代码在

## 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]

将带有表单的HTML文件发送到PHP文件的函数不起作用。表单与post一起工作,然后在PHP文件中我有。

<?php
if(!isset($_POST["submit"]))
{
echo "error; you need to submit the form!";
}
$name = $_POST["name"];
$visitor_email = $_POST["visitor_email"];
$message = $_POST["message"];

此代码不再工作。我猜是因为用。htaccess重写了url,

  • 我该如何解决这个问题,使我的php脚本可以运行
  • 和文件目录被保护,不能查看
  • 和php扩展是不可见的

感谢阅读

将这行插入RewriteBase以忽略POST请求的重写规则:

RewriteCond %{REQUEST_METHOD} POST
RewriteRule ^ - [L]