php - PHP .htaccess 重写 url
问题描述
我在下面写了 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]
解决方案
使用 flag R=301
,您正在执行重定向,而不是仅在内部重写 URL。删除它,一切都应该正常
推荐阅读
- flutter - flutter_audio_query 问题 sound null 安全
- python - python代码显示无效语法(文件夹名称='ebert_reviews')
- java - 即使我没有使用 Thymeleaf,我该如何解决 org.thymeleaf.exceptions.TemplateInputException?
- html - 为什么我在 CSS linear-gradient() 中的度数不能正常工作?
- powerbi - PowerBi 本地文件夹超时
- c - 为什么从 PTY 从站读取会更改行(学科)设置?
- flutter - 如何从网上打开excel文件
- css - 将 svg 代码设置为 div 的背景
- r - Plotly 中的 Add_Trace 问题
- c# - 注入错误:不支持配置文件。在 System.ServiceModel.ClientBase`1..ctor() 在 Asp .Net5