Showing posts with label Redirect non-www to www with .htaccess. Show all posts
Showing posts with label Redirect non-www to www with .htaccess. Show all posts

Monday, 26 October 2015

How to Redirect non-www url to www url with .htaccess PHP


How to Redirect non-www url to www url with .htaccess PHP

write below code in your .htaccess file at very top....

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]