添加.htaccess文件后,表单提交停止工作


form submit stops working after adding .htaccess file

我已经添加了以下。htaccess文件

RewriteEngine On
RewriteBase /site/public/admin/
RewriteCond %{THE_REQUEST} 's([^.]+?)(?:'.php)?'?caseid=([^&'s]+) [NC]
RewriteRule ^ %1/caseid/%2/? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/caseid/([^/]+)/?$ $1.php?caseid=$2 [L,NC,QSA]
## hide .php extension snippet    
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}'s([^.]+)'.php [NC]
RewriteRule ^ %1/ [R=302,L]
# add a trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule [^/]$ %{REQUEST_URI}/ [L,R=301]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

添加上述代码后,我的表单提交按钮停止工作。HTML表单标签

<form role="form" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post" id="rta_parties_form">
    <?php require_once 'php_include/parties/form_parties.php';?>
</form>

我也试过下面的方法,但也不起作用。

RewriteCond %{REQUEST_METHOD} !POST

在模式下不好重写

任何想法?

将此规则插入RewriteBase行后,以跳过POST请求的重写规则:

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

您可以在.htaccess文件

中尝试以下操作
RewriteCond %{REQUEST_METHOD} !POST [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}'s([^.]+)'.php [NC]
RewriteRule ^ %1 [R,L,NC]

你可以使用完整答案的链接