.htaccess重写规则未提交发布表单数据?

.htaccess rewrite rule not submitting post form data?

提问人:Pirah Bughio 提问时间:9/5/2023 更新时间:9/5/2023 访问量:30

问:

htacccess 重写 URL 规则没有 .php 扩展名,还有一些带有类别名称作为参数的 URL 我已经成功地完成了这两个工作,但是在此之后,我的帖子表单方法不起作用,我需要帮助,这是我的 .htacess 代码和表单

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.+)\.php [NC]
RewriteRule ^ /%1 [R=301,L]

# Rewrite extensionless URLs to .php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)$ $1.php [NC,L]


RewriteBase /






# Redirect requests for category URLs to category.php with the category parameter
RewriteRule ^collections/([^/]+)/?$ collections/category.php?category=$1 [L]

RewriteRule ^categories/([^/]+)/?$ categories/category_url.php?category=$1 [L]



## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 day" ExpiresByType image/jpeg "access plus 1 day" ExpiresByType image/gif "access plus 1 day" ExpiresByType image/png "access plus 1 day" ExpiresByType text/css "access plus 1 day" ExpiresByType application/pdf "access plus 1 dya" ExpiresByType text/x-javascript "access plus 1 day" ExpiresByType application/x-shockwave-flash "access plus 1 day" ExpiresByType image/x-icon "access plus 1 day" ExpiresDefault "access plus 2 days" </IfModule> 

## EXPIRES CACHING ##

这是一个 formn 代码

<form action="/update_cart" method="POST"> 
                        
                        <input type="hidden" name="p_sku" value="<?php echo $pro['sku']; ?>"></form>

也带有 ajax 请求

xhr.open('POST', '/update_cart', true);

我尝试以操作形式更新 URL,您可以在表单操作属性中看到

PHP ajax 表单 .htaccess 帖子

评论


答: 暂无答案