Like Us on Facebook

How to redirect non-www URLs to www without htaccess

To redirect your to you have to write a simple code using php. Bellow code you have to paste at the top of your page.

        $protocol = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
          if (substr($_SERVER['HTTP_HOST'], 0, 4) !== 'www.')
               header('Location: '.$protocol.'www.'.$_SERVER['HTTP_HOST'].''.$_SERVER['REQUEST_URI']);

And now when someone go to your domain like he will be redirected to

Posted By UandBlog

UandBlog is a Global Leading source of Finance, Health, Lifestyle, Technology, Gaming and Programing and other information, it is a fastest growing blog for all , for latest post or information like us on facebook , follow on Twitter, Google+ and Pinterest.

Comments ( 0 )

    Leave a comment..

    Click to login.