PHP .htaccess重写网址

问题描述 投票:2回答:1

我写了下面的URL重写规则,但它也删除了post参数。请帮我用原始参数重写URL

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
php apache .htaccess php-7.2
1个回答
2
投票

使用标志R=301,您正在执行重定向,而不是仅在内部重写URL。删除它,一切都应该正常

© www.soinside.com 2019 - 2024. All rights reserved.