Example user input
http://domain.com/
http://domain.com/topic/
http://domain.com/topic/cars/
http://www.domain.com/topic/questions/
I want a php function to make the output like
domain.com
domain.com/topic/
domain.com/topic/cars/
www.domain.com/topic/questions/
Let me know :)
You should use an array of "disallowed" terms and use
strpos
andstr_replace
to dynamically remove them from the passed-in URL: