code: public function standardizeUrlFormat(&$rules, $pageUrl)
      {
          if (!is_string($pageUrl) || $pageUrl==="" || !is_array($rules) ||
                  !array_key_exists($pageUrl, $rules) ) {
              return;
          }
          
          $oldIndex=$pageUrl;
          if ($pageUrl[0] !== '/') {
              $pageUrl='/'.$pageUrl;
          }
          $len=strlen($pageUrl);
          if ($len>1 && $pageUrl[$len-1]==='/') {
              $pageUrl= rtrim($pageUrl, '/');
          }
          if ($oldIndex!==$pageUrl) {
              $rules[$pageUrl]=$rules[$oldIndex];
              unset($rules[$oldIndex]);
          }
      }
docs: Corrects URL index if it does not have a correct format
  
  Add a leading slash to the page URL if not present.
  And remove trailing slash from the end if present.
  If the change is made, the array key is moved inside the
  {$rules} array.
  
  @param array $rules Reference to $rules array
  @param string $pageUrl URL to be checked and corrected