简体   繁体   English

如何使用mod_rewrite从URL删除斜杠并发送以获取变量

[英]How do I remove trailing slash from URL using mod_rewrite and send to get variable

I have the below rule which works fine for domain.com/search/term 我有以下规则,适用于domain.com/search/term

I would like this to also work for domain.com/search/term; 我希望这也适用于domain.com/search/term;

RewriteRule ^send/(.*)$ send.php?s=$1 [L,QSA]

Two things i would like to achieve: 我想实现两件事:

1) make the url in the browser bar change to the url without trailing slash 1)将浏览器栏中的网址更改为该网址,且不带斜杠

2) send the get url without the trailing slash 2)发送不带斜杠的获取网址

这行应该做你想要的:

RewriteRule ^search/term/(.*)/$ search/term/$1 [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM