如何使用htaccess从URL中删除//

How to remove / from URL if they appear twice or thrice.
Like:

 www.site.com/mauritius_holiday_rentals/search//2/Pool-Villa

should become

 www.site.com/mauritius_holiday_rentals/search/2/Pool-Villa

and

www.site.com/mauritius_holiday_rentals/search///Beach-Villa

should become

www.site.com/mauritius_holiday_rentals/search/Beach-Villa

Try this:-

RewriteEngine On
RewriteCond %{HTTP_HOST} ^http://www.example.com/mauritius_holiday_rentals/search/$
RewriteRule (.*) http://www.example.com/mauritius_holiday_rentals/search///$1 [R=301]

You can use RedirectMatch directive With Regex, so If an additional forword slash was added accidently to the url ,then you have a chance to make it optional or permanently delete it from the url.

 RedirectMatch 301 ^/mauritius_holiday_rentals/search//?/?/2/(.*)$ /mauritius_holiday_rentals/search/2/$1


 RedirectMatch 301 ^/mauritius_holiday_rentals/search//?/?/(.*)$ /mauritius_holiday_rentals/search/$1