Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mail.php不';无法使用.htaccess_Php_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Mail.php不';无法使用.htaccess

Mail.php不';无法使用.htaccess,php,regex,apache,.htaccess,mod-rewrite,Php,Regex,Apache,.htaccess,Mod Rewrite,如果我把这个.htaccess代码放进去,我的电子邮件php文件就不能工作了 ## 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] Re

如果我把这个.htaccess代码放进去,我的电子邮件php文件就不能工作了

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

重写库
下方插入这一行,忽略POST请求的重写规则:

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

“不工作”是什么意思?您正在通过
\u POST
发送数据,因此url中没有参数。您可以通过url访问此文件吗?%{REQUEST_FILENAME}是否已经有文件扩展名?当我从根目录中删除我的htaccess时,我可以使用邮件文件,但当我将其放入代码中时,它不起作用。我对htaccess不太熟悉,因此很抱歉,我不知道在我自己的系统上尝试过的InaseBits按预期工作