Redirect non WWW to WWW and 404 redirect

Redirect non WWW to WWW

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

Place this code in .htaccess file.

404 Redirect Code:

ErrorDocument 404 /index.html

or you can replace index.html with your 404 page.

Comments

Popular posts from this blog

The Right Word for Right Lead

Google makes Rich Medical Content into Knowledge Graph

Google Analytics: Multiple tracking codes on web pages