Jump to content

Extract Base URL From Entire Url


Brandon_R

Recommended Posts

Hello guys i need a bit of help with this. I need a regex to extract the base URL from a long url. Please take a look at the following example:

 

http://www.example.com/1-link-to-the-page.html

 

after the regex is run on the above code $url should contain

 

http://www.example.com/

 

Thank You In Advance for your help :)

Link to comment
https://forums.phpfreaks.com/topic/175838-extract-base-url-from-entire-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.