Safari auto redirect me to unwanted urls
Hello,
i have a big problem and i can't find a solution for it,
when i try to enter any website on safari or chrome it redirect me automatically to another unwanted url and spam websites in the same tab i try to enter a website in.
i tried to clear all websites data and caches and history and the problem still remain, and also i tried to reset my internet router 2 times and nothing happened,
i don't know what to do and i need your help,
thank you.
MacBook Pro, iOS 10.1.1