vedoj's avatar
Level 1

How to get the part after domain name in URL?

If I use the url helper the output is the full path with the domain name:

http://example.com/and-i-want/only/this-part

What helper allows me to grab only the and-i-want/only/this-part?

This is such a common thing to do, but I can't find anything through Google.

0 likes
2 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102
parse_url('http://example.com/and-i-want/only/this-part')['path']
1 like

Please or to participate in this conversation.