{"id":3460,"date":"2010-08-18T01:30:05","date_gmt":"2010-08-18T05:30:05","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/?p=3460"},"modified":"2010-08-18T01:30:05","modified_gmt":"2010-08-18T05:30:05","slug":"multiple-server-alias","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/","title":{"rendered":"Multiple server alias"},"content":{"rendered":"<p>From <a href=\"http:\/\/www.domainhelp.com\/2010\/04\/how-do-i-point-www-domain-com-at-domain-com-or-vice-versa\/\" target=\"_blank\" rel=\"noopener noreferrer\">domainhelp.com<\/a><\/p>\n<p>How do I point \u201cwww.domain.com\u201d at \u201cdomain.com\u201d or vice-versa?<\/p>\n<p>You may have your webserver setup for either www.example.com or just example.com and you want it to work either way, whether people type in the \u201cwww\u201d part of your domain or not. (By way of info, \u201cwww\u201d is purely a convention, it isn\u2019t in itself necessary to \u201cmake your domain work\u201d over the web).<\/p>\n<p>There are a couple ways to do this:<\/p>\n<p>Setup a host record or A record for the root example.com domain. Then create a CNAME record or alias which points www.example.com at this host record.<\/p>\n<p>In a bind style zone file you would put this:<\/p>\n<p><code><br \/>\nexample.com.                   IN A    192.168.3.44<br \/>\nwww.example.com.                 IN CNAME example.com.<br \/>\n<\/code><\/p>\n<p>Take special care to make the root domain the host\/A record and the \u201cwww\u201d hostname the alias\/CNAME. If you do it the other way around, more often than not, you will cause your zone to fail with errors because under most circumstances, the root of your zone cannot itself be an alias\/CNAME.<\/p>\n<p>Alternatively, you could simply setup a host record for each record, both pointing to the IP address:<\/p>\n<p><code><br \/>\nexample.com.                   IN A    192.168.3.44<br \/>\nwww.example.com.                 IN A 192.168.3.44<br \/>\n<\/code><\/p>\n<p>The first method has a slight advantage in that you only need to change one record if the IP address of your webserver changes. If you are using an outsourced DNS host to do this, the interface usually calls the A records \u201chosts\u201d and the CNAME records \u201caliases\u201d. Often people get this far and then their website loads fine under one method (say, http:\/\/example.com) but they get unexpected results from the other http:\/\/www.example.com, such as an error \u201cNo website configured at this address\u201d or getting some other website entirely. This is because you still need to tell your webserver to respond to both hostnames.<\/p>\n<p>When a user accesses a website in her browser, the browser sends a header setting an environment variable called HTTP_HOST, and webservers key off of this value to decide which local \u201cwebhost\u201d or \u201cvirtualhost\u201d to load (this is how web hosting companies can host thousands of websites on a single IP address.) In our example, we\u2019re using the apache webserver, and you need to specify in your \u201cVirtualHost\u201d directive that the website needs t respond to requests from both example.com and www.example.com, you do this with a \u201cServerAlias\u201d statement:<\/p>\n<p><code><br \/>\n<virtualhost 192.168.3.44><\/p>\n<p>ServerName              example.com<\/p>\n<p>ServerAlias              www.example.com *.example.com<\/p>\n<p># other stuff<\/p>\n<p><\/virtualhost><br \/>\n<\/code><\/p>\n<p>You can add multiple entries per ServerAlias line, in our example above we have added a \u201cwildcard\u201d entry for example.com, if you setup a wildcard DNS entry in the zonefile, this webserver would load properly for http:\/\/<anything>.example.com. You could also enter multiple ServerAlias lines, if you wanted your website to respond on another domain name as well.<\/anything><\/p>\n","protected":false},"excerpt":{"rendered":"<p>From domainhelp.com How do I point \u201cwww.domain.com\u201d at \u201cdomain.com\u201d or vice-versa? You may have your webserver setup for either www.example.com or just example.com and you want it to work either way, whether people type in the \u201cwww\u201d part of your domain or not. (By way of info, \u201cwww\u201d is purely a convention, it isn\u2019t in&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-3460","post","type-post","status-publish","format-standard","hentry","category-info"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Multiple server alias - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Multiple server alias - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"From domainhelp.com How do I point \u201cwww.domain.com\u201d at \u201cdomain.com\u201d or vice-versa? You may have your webserver setup for either www.example.com or just example.com and you want it to work either way, whether people type in the \u201cwww\u201d part of your domain or not. (By way of info, \u201cwww\u201d is purely a convention, it isn\u2019t in... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2010-08-18T05:30:05+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/multiple-server-alias\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/multiple-server-alias\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"Multiple server alias\",\"datePublished\":\"2010-08-18T05:30:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/multiple-server-alias\\\/\"},\"wordCount\":458,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"General Info\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/multiple-server-alias\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/multiple-server-alias\\\/\",\"name\":\"Multiple server alias - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2010-08-18T05:30:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/multiple-server-alias\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/multiple-server-alias\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/multiple-server-alias\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Multiple server alias\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Multiple server alias - Linux Shtuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/","og_locale":"en_US","og_type":"article","og_title":"Multiple server alias - Linux Shtuff","og_description":"From domainhelp.com How do I point \u201cwww.domain.com\u201d at \u201cdomain.com\u201d or vice-versa? You may have your webserver setup for either www.example.com or just example.com and you want it to work either way, whether people type in the \u201cwww\u201d part of your domain or not. (By way of info, \u201cwww\u201d is purely a convention, it isn\u2019t in... Read More","og_url":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2010-08-18T05:30:05+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"Multiple server alias","datePublished":"2010-08-18T05:30:05+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/"},"wordCount":458,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["General Info"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/","url":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/","name":"Multiple server alias - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2010-08-18T05:30:05+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/multiple-server-alias\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/multiple-server-alias\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"Multiple server alias"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=3460"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3460\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=3460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=3460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=3460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}