Why do you reckon the following script is unable to replace the 'https://' or the 'http://' words with 'http://mymydomain.com' ?
It is able to replace the words 'www.' with 'http://mymydomain.com', though.
Open 2 tabs in your browser where one opens to the page where you are running the following script in your wamp/xampp and the other tab should open direct to [url]http://ebay.com[/url] for your experiment.
Running the script in your wamp/xampp and hovering your mouse over "fashion" link on ebay would show you 'http//mymydomain.com/tracker.php?ebay.com/global/fashion' and that is proof 'www.' got replaced.
You may confirm this cross checking both tabs by hovering your mouse over the mentioned links.
Now, in the (non xampp/wamp) tab, hover your mouse over the links "register", "sign in", etc. and you will see they start with 'https://'. Then finally, in the other tab (xampp/wamp), hover your mouse over these same links and you'd see the 'https://' have not been replaced with 'http://mymydomain.com'.
Why is that ?
Why is the str_replace failing on these 2 occasions to replace the 'http://' and the 'https://' to 'http://mymydomain.com' ?