I am looking for PHP code to find if there are more than one slash(/) at the end of URL. For example I want an if condition with following structure:
$requesturl = $_SERVER['PATH_INFO']
if ( <condition> ) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: <url>");
}
I am looking for the condition and url code. The condition needs to detect more than one trailing slash at the end of $requesturl and url has to be the current page url with only one trailing slash.
If the URL has two or more slashes at the end of it: