Non-WWW to WWW URL - Htaccess

301 Redirect

Snippet Code

Rate this page :
  [ 0 votes]

.htaccess file is used for webpage redirection. Here is the code snippet to redirect users to access the site without www and vice-versa.

301 Redirect www to non-www: RewriteEngine On RewriteCond %{HTTP_HOST} ^$ [NC] RewriteRule ^(.*)$$1 [L,R=301] 301 Redirect Non www to www: RewriteEngine on RewriteCond %{HTTP_HOST} ^ [NC] RewriteRule ^(.*)$$1 [R=301,L]


Ask Questions

Ask Question