Sanitize URLs

Hi guys, I’m trying to find out a way to sanitize urls using default urlManager and make them cleaner and safer, maybe somebody has a solution.

I tried extend CurlManager and clean the url using this example or this other one but the result was unsuseful.

Thanks in advance.

You can use PHP inbuilt filters

e.g.


filter_var($url,FILTER_SANITIZE_URL)

Complete list and more info at http : // php . net/manual/en/book. filter. php