how to redirect 301 all page to www or none www

You can use rewrite url in htaccess to redirect 301 all page to www

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

You can use rewrite url in htaccess to redirect 301 all page to noneĀ www

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

P/s: You need to enableĀ mod_rewrite for your server.

Add Comment

Required fields are marked *. Your email address will not be published.