Hi guys,

I already know basic Redirect www to non-www, using htaccess:

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

but how if we have parked domain too?

I already tried this but its not works, its says "The page isn't redirecting properly"

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

please share your knowledge, what is the best way for this?

In the case of Parked domain , both the names should point to the same domain name.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain2.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

Please have a try on this and let us know if this works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.