Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Newbie question about name servers

canonical issues

3:13 pm on Nov 10, 2012 (gmt 0)

New User

5+ Year Member

joined:Mar 31, 2008
votes: 2

I have a question regarding name servers. I'm not sure how to ask it so I'll use an example.

Ns2.mydomain.com resloves to mydomain.com
Does this not cause canonical issues? And if it does how do I reslove it?

Is there a way in htaccess to redirect all occurances of ns2.mydomain.com to mydomain.com
3:35 pm on Nov 10, 2012 (gmt 0)

New User

5+ Year Member

joined:Mar 31, 2008
votes: 2

Sorry what I should have asked is how do I make it so ns2.mydomain.com when typed into the browser shows a 404? Or does it matter?
4:35 pm on Nov 10, 2012 (gmt 0)

Full Member

joined:Apr 27, 2012
posts: 301
votes: 0

Here's something I use in htaccess:
RewriteCond %{HTTP_HOST} ^example.com [OR]
RewriteCond %{HTTP_HOST} ns1.example.com [OR]
RewriteCond %{HTTP_HOST} ns2.example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

It's the same as rewriting your non-www to www, note the "R=301", it tells search engines like Google this is permanent.

EDIT: Chnged domain to example.com

[edited by: Str82u at 5:13 pm (utc) on Nov 10, 2012]

4:50 pm on Nov 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
votes: 0

Please use example.com in this forum, as per the sticky note at the top of the forum thread list.

Your example fails to redirect some non-canonical requests.

Escape all literal periods in patterns.

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