简体   繁体   中英

.Htaccess remove slash at the end

I need to add a rewrite rule, but automatically add the slash at the end, and I don't need it.

I use this rule:

RewriteRule ^print-res/([0-9+/=$]*)/([A-Za-z0-9+/=$]*)$ print-res.php?idreserva=$1&tkn=$2 [QSA,L]

If I go to this url, for example: www.xxx.com/print-res/25/1kewnfd231

httacces redirect me to: www.xxx.com/print-res/25/1kewnfd231/

And the tkn parameter its like: 1kewnfd231/ Not 1kewnfd231

Who can I remove the last / ?

Thanks!

Assuming that the problem was specifically with that rule, you can try to rewrite it like this:

RewriteRule  ^print-res/([^/]*)/([^/]*)/?$ print-res.php?idreserva=$1&tkn=$2 [NC,QSA,L]

It should change both www.xxx.com/print-res/25/1kewnfd231 and www.xxx.com/print-res/25/1kewnfd231/ to: www.xxx.com/print-res.php?idreserva=25&tkn=1kewnfd231 (without the / ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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