homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Newbie question about name servers
canonical issues

5+ Year Member

Msg#: 4517793 posted 3:13 pm on Nov 10, 2012 (gmt 0)

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



5+ Year Member

Msg#: 4517793 posted 3:35 pm on Nov 10, 2012 (gmt 0)

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?


Msg#: 4517793 posted 4:35 pm on Nov 10, 2012 (gmt 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]


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

Msg#: 4517793 posted 4:50 pm on Nov 10, 2012 (gmt 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]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved