Well, i want remove slash and rest of url after domain name. in this code:
$url = $_POST['url'];
$result = preg_replace('#/[^/]*$#', '', $url);
echo $result;
it will remove slash and after it (/index.php), but only when URL be something like this:
but in this:
or more slashes it will only remove last slash and trail (/test).
I want remove first slash after domain:
Example:
Remove:
/index/test/test/test/test/test/test
Result:
I don't know how to define first slash after domain and trails. Second problem is when url is:
it will remove /test.com but i never want this, i want when url hasn't any slash after domain name it DO NOT remove second slash from http:// ! well, i know i should define that remove first slash after domain or in other hand first slash in path or php self.