.htaccess从路径末端重写规则
我需要根据以下模式重写我的URL规则:
启动URL:
https://example.com/path/&ppath/¶m1=1¶m2=2
tastion>目标url:
httpps ://example.com/file.php?param1 = 1& param2 = 2
i因此,我需要获取& amp;特点。
我知道它形成的启动URL和那是吗?需要,但是不幸的是,我有这种模式可遵循。 我尝试了这个,但我无法获得&特点。
重写 ^路径([&])$ file.php?$ 1 [l]
您有什么想法吗?
I need to rewrite the rule for my url according to this pattern:
Starting url :
https://example.com/path/¶m1=1¶m2=2
Destination url:
https://example.com/file.php?param1=1¶m2=2
I therefore need to get everything that comes after the & character.
I know it's poorly formed the starting url and that the ? would be needed, but unfortunately I have this pattern to follow.
I tried this but I can't get the & character.
RewriteRule ^path([&])$ file.php?$1 [L]
Do you have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用您显示的样本,请尝试遵循HTACCESS规则文件。这确实是内部重写到file.php并将查询字符串发送为
param1 = 1& param2 = 2
在后端中。还要确保您的file.php和.htaccess规则文件处于同一路径。在测试URL之前,请确保清除浏览器缓存。
With your shown samples, attempts please try following htaccess rules file. This does internal rewrite to file.php and sends query string as
param1=1¶m2=2
in backend.Also make sure your file.php and .htaccess rules file are in same path. Make sure to clear your browser cache before testing your URLs.