I want to get a part of this url using php, what will be best approach
example url:
http://www.domain.com/44-Paris/blogs-for-travel/tour1.html
use parse_url
<?php $url = 'http://www.domain.com/44-Paris/blogs-for-travel/tour1.html'; $parse = parse_url($url); $path = explode('/', $parse['path']); echo $parse['scheme']."://".$parse['host']."/".$path[1]."/"; ?>