I have an input field where the user can type an URL. He could type the URL in many different ways, for example:
- www.example.com
- http://example.com
- http://www.example.com
- example.com/index.php
No matter how he types it, I want to echo it like this: example.com
Only when it is an sub domain, then it should look like this: subdomain.example.com
How can I do this?