php redirect to www

This shows how to make a php redirect from “” to “”.

if (substr($_SERVER['HTTP_HOST'], 0, 4) !== 'www.') {
    header('Location: '.$protocol.'www.'.$_SERVER['HTTP_HOST'].str_replace('//','/','/'.$_SERVER['REQUEST_URI']));

2 thoughts on “php redirect to www”

  1. You could definitely see your enthusiasm within the work you
    write. The world hopes for more passionate writers like you who are not afraid to mention how they believe.
    Always go after your heart.

  2. First of all I want to say wonderful blog! I had a quick question which I’d like
    to ask if you don’t mind. I was curious to know how you center yourself and clear your head prior to writing.
    I have had a tough time clearing my thoughts in getting my
    ideas out. I truly do enjoy writing however it
    just seems like thhe first 10 to 15 minutes tend to bee lost
    just trying to figure out how to begin. Any ideas or hints?

Leave a Reply to BradlyXMcloud Cancel reply

Your email address will not be published.

three × 1 =