I am trying to add "www" to the front of my URL if the user didn't add it. The problem is that I have several possible entries that I don't want changed.
The addresses I don't want changed are as follows:
But, if the URL is "http://sitename.com
" or "sitename.com", I need it to change to "http://www.sitename.com
" or "www.sitename.com
Here is my code:
var oldUrl = window.location.href;.
var myRegExp = "www.|origin.|ads.|172.|in
var string1 = window.location.href;
var matchPos1 = string1.search(myRegExp);
if(matchPos1 != -1)
// this is where I need to rewrite the URL
Another problem is that the "in" part is in some of the other parts of the URL.
Thanks in advance for the help.