Best way to remove trailing slashes in URLs with PHP
php
Solution
You put `rtrim` in your question, why not just look it up?
$url = rtrim($url,"/");
As a side note, look up any PHP function by doing the following:
- http://php.net/functionname
- http://php.net/rtrim
- http://php.net/trim
(`rtrim` stands for 'Right trim')
Problem
I have some URLs, like `www.amazon.com/`, `www.digg.com` or `www.microsoft.com/` and I want to remove the trailing slash, if it exists, so not just the last character. Is there a `trim` or `rtrim` for this?