URI->_remove_url_suffix() : suffix has to be at the end of uri_string

related to #2135
diff --git a/system/core/URI.php b/system/core/URI.php
index b3603bb..8d0d8fd 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -353,9 +353,16 @@
 	{
 		$suffix = (string) $this->config->item('url_suffix');
 
-		if ($suffix !== '' && ($offset = strrpos($this->uri_string, $suffix)) !== FALSE)
+		if ($suffix === '')
 		{
-			$this->uri_string = substr_replace($this->uri_string, '', $offset, strlen($suffix));
+			return;
+		}
+
+		$offset = strrpos($this->uri_string, $suffix);
+
+		if ($offset !== FALSE && $offset === strlen($this->uri_string) - strlen($suffix))
+		{
+			$this->uri_string = substr($this->uri_string, 0, $offset);
 		}
 	}