How to redirect with www. in php

#redirects with www.website name from website.com Add this code in your .htaccess file in public html folder. RewriteCond %{HTTP_HOST} ^website.com RewriteRule (.*) http://www.website.com/$1 [R=301,L]