homepage Welcome to WebmasterWorld Guest from 54.237.213.31
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

    
DNS Records - Change via Domain Registrar or Plesk?
scott78



 
Msg#: 4593499 posted 11:42 am on Jul 16, 2013 (gmt 0)

Hello all

I am a novice who has played around setting up a few websites but I have a few fundamental questions about DNS which I can't quite get my head around and can never find simple explanations for.

Whenever I purchase a domain I currently leave its Nameservers with the registrar (e.g. Fasthosts.com) and set a DNS A Record from the registrar control panel which points to my VPS. I've read that it's best to do this because changing the Nameservers to my VPS would use up extra resources? But, I can never quite work out the correct way to do things from there. So, could some kind soul answer me these simple questions:

1) Should I leave NS with the registrar and point an A record to my VPS IP?
2) If so, what about the other DNS records? Do I change those with the domain registrar (Fasthosts) or on the VPS via Plesk?

I'm currently using Plesk v11.0.09 on a Windows server.

Many thanks
Scott

 

dmorison

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4593499 posted 2:22 pm on Jul 16, 2013 (gmt 0)

Hello Scott, and welcome to WebmasterWorld!

1) Should I leave NS with the registrar and point an A record to my VPS IP?


Yes, I think this is what most people do unless there is a good reason not to, and it's one less thing to worry about managing on your VPS!

The big registrars that also offer DNS for your domains are very experienced at running DNS and they likely have considerable redundancy etc. in place - there's simply no need to have your VPS deal with DNS when your registrar is offering it as part of their service.

2) If so, what about the other DNS records? Do I change those with the domain registrar (Fasthosts) or on the VPS via Plesk?


It all needs to be done in the same place, so if your domain record points to fasthosts as the authority DNS you need to manage all record types there.

And further, if your VPS control panel allows it you can / should disable DNS service as there's no need to have the ports open if they're not required.

scott78



 
Msg#: 4593499 posted 3:11 pm on Jul 16, 2013 (gmt 0)

Great, thank you, dmorison! I'm glad you added the bit about disabling DNS in the VPS control panel as I really wasn't sure if/when I should use that. That hammers home the fact that Fasthosts will be my authority DNS and I don't need to worry about what's going on in Plesk.

Another quick question, if you'd be so kind...I'm trying to make the base domain the one without 'www' so I've set an '@' A record pointing to the IP of the VPS (46.32.xx.yy) and a 'www' CNAME pointing to the domain (example.co.uk) - should this be all I need to do to make www.example.co.uk direct to example.co.uk, or do I need a 'www' A record?

And, have I done it the correct way around in terms of SEO, or does it not matter?

[edited by: phranque at 10:34 am (utc) on Jul 17, 2013]
[edit reason] exemplified domain and IP [/edit]

dmorison

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4593499 posted 4:42 pm on Jul 16, 2013 (gmt 0)

Hello Scott,

I do exactly the same with some of my web properties where "www" doesn't fit and "example.com" is the brand, and the DNS setup is exactly as you describe - an A record for "example.com" to the server IP address, with "www.example.com" set up as a CNAME pointing to "example.com". The Apache configuration on the server then redirects any request to www. to the equivalent non-www URL.

You should really use example.com in your posts to WebmasterWorld, but in terms of your question regarding SEO and whether or not it makes a difference, I don't think so as long as you make sure that www. is redirected to the non-www preferred version under all circumstances, and I think it's OK to cite a household domain name in this case - if you go www.slashdot.org you are unceremoniously redirected to slashdot.org ...

scott78



 
Msg#: 4593499 posted 7:51 pm on Jul 16, 2013 (gmt 0)

Thanks once again and sorry about using the domain/ip details - didn't realise it was bad form!

For some reason I can't seem to get this redirect working from www to non-www. I've changed the DNS records quite a bit today so perhaps it needs to propogate properly, but I'm sure I've tried it before and it didn't work then either.

Not to worry, I'll see how it's looking tomorrow.

Thanks again for your help, really appreciate it

Scott

dmorison

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4593499 posted 8:13 am on Jul 17, 2013 (gmt 0)

Hi Scott,

I normally implement the redirection in the VirtualHost container in the Apache configuration, e.g.

<VirtualHost *:80>
ServerName example.com:80
UseCanonicalName Off
DocumentRoot /home/example/vhosts/example.com/
</VirtualHost>
<VirtualHost *:80>
ServerName www.example.com:80
Redirect 301 / http://example.com/
</VirtualHost>

However if you'd rather leave Plesk in charge of the Apache configuration then the .htaccess version would be something like:

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

phranque

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



 
Msg#: 4593499 posted 10:32 am on Jul 17, 2013 (gmt 0)

welcome to WebmasterWorld, Scott!


i would advise using separate providers for your registrar, DNS and web hosting.
see jtara's post in this thread for a discussion of why this is a good idea:
http://www.webmasterworld.com/domain_names/3284527.htm?highlight=msg3284856 [webmasterworld.com]


Redirect 301 / http://example.com/

Redirect is a mod_alias directive.
RewriteRule is a mod_rewrite directive
you should never mix them within a server configuration, especially if you are using mod_rewrite to internally rewrite urls as you would with most CMSs.
the reason is that the mod_alias directives will fire after the mod_rewrite directives, exposing your internal urls.


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


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


the reason for using the ( ) ? in the RewriteCond is to avoid an infinite redirect loop for HTTP/1.0 user agents which don't send a Host: HTTP Request header.

dmorison

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4593499 posted 11:29 am on Jul 17, 2013 (gmt 0)

you should never mix them within a server configuration, especially if you are using mod_rewrite to internally rewrite urls as you would with most CMSs.


Makes sense - just to clarify my Redirect 301's are in completely separate VirtualHost containers to the VirtualHost being redirected to, which also means that mod rewrite doesn't have to process the classic method of redirection for every single page view. I know it's only a squillionth of a millisecond but I like to minimise the server's effort as much as possible...

Thx for clarification of the .htaccess method / infinite redirect possibility...!

phranque

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



 
Msg#: 4593499 posted 11:47 am on Jul 17, 2013 (gmt 0)

a VirtualHost container and a .htaccess file in the directory structure for that virtual host containing this mixture would also be problematic.

note that besides the exposure of internal urls you also want to avoid multiple 301 hops for an initial request.

dmorison

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4593499 posted 11:52 am on Jul 17, 2013 (gmt 0)

Hi phranque,

Not sure I understand sorry, I don't see how they can become mixed;

Apache config:

<VirtualHost *:80>
ServerName example.com:80
UseCanonicalName Off
DocumentRoot /home/example/vhosts/example.com/
</VirtualHost>

<VirtualHost *:80>
ServerName www.example.com:80
Redirect 301 / http://example.com/
</VirtualHost>


A request to www.example.com is redirected to example.com and that is the end of any involvement of the www.example.com VirtualHost. Note that the www.example.com VirtualHost doesn't even have a DocumentRoot directive, so I don't see how they can come into conflict at all..?

phranque

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



 
Msg#: 4593499 posted 12:09 pm on Jul 17, 2013 (gmt 0)

that avoids the mod_alias/mod_rewrite conflct in this specific configuration.

however, if you have another redirect in example.com's .htacccess you've got multiple hops, which could be avoided if you used a single VirtualHost and a ServerAlias.

dmorison

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4593499 posted 5:23 pm on Jul 17, 2013 (gmt 0)

however, if you have another redirect in example.com's .htacccess you've got multiple hops, which could be avoided if you used a single VirtualHost and a ServerAlias.


But I don't, and never said I did!

I was suggesting two alternatives to the OP, an Apache configuration solution (my preferred option, if available, as it removes the requirement to process a canonical correction RewriteRule for every single page view, or a .htaccess solution otherwise.

If the .htaccess of the redirection destination happens to make another 301 redirect that is a separate issue, unrelated to the thread topic, and I agree, should be completely avoided!

phranque

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



 
Msg#: 4593499 posted 6:12 pm on Jul 17, 2013 (gmt 0)

I am assuming you have your configuration well under control, dmorison.

however, the OP began with "I am a novice..." and therefore should be provided an explanation of the risks and benefits of all suggested options.

dmorison

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4593499 posted 6:14 pm on Jul 17, 2013 (gmt 0)

OK :(

phranque

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



 
Msg#: 4593499 posted 8:23 pm on Jul 17, 2013 (gmt 0)

don't take it personally, dmorison.
when i said "you should never mix..." i was addressing the OP and speaking hypothetically about issues that often occur rather than specifically about your configuration requirements.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
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