One thing to consider is that not all site hosting providers register the www part in the URL. You an also use the function strpos("url the user entered","http://") and if it is false they didn't add it and you should. (Note that you should use three equal signs to compare it with false because the location might be at the zero string which is similar to false) strpos is better and slightly quicker for simple searches than regex