I have the following.
what should I add to make example.com be redirected to www.example.com?
Name TTL Type Address
example.com 14400 A 153.92.211.25
www.example.com 14400 A 153.92.211.25
www.example.com 14400 CNAME example.com
You can't.
A CNAME record is as close as you can get, but that only causes example.com to resolve to the same address as www.example.com.
This is great for when you have multiple hostnames that need to resolve to the same server as, if you ever change the IP address of that server, you only have to update one record.
(Note that a CNAME record can't be applied to the root of the domain. You can use CNAME to say that www.example.com or cdn.example.com resolve to example.com but not the reverse).
It won't cause the client to redirect though. It will ask for example.com and be told 153.92.211.25, not "You should go to www.example.com instead.
For a redirect you need to use an HTTP redirect. Generally this will be a 301 Moved Permanently status and a Location header with the new URL (https://www.example.com) as the value.
Related
I have www.mydomain.com and mydomain.com both working. Now, the subdomain sub.mydomain.com also works well; but not www.sub.mydomain.com.
I've tried adding A records for for www.app; but not working.
I've also tried creating a CNAME record "www.app" for mydomain.com; but also not working.
Browser throws a NET::ERR_CERT_COMMON_NAME_INVALID for both.
Any suggestions?
I am unable to redirect www.mydomain.com to mydomain.com. I have tried adding an A record with subdomain www and IP address from firebase, but that doesn't work. Any suggestions?
You need to setup forwarding of your subdomain (www) as follows:
Goto GoDaddy's Manage DNS page and scroll down to forwarding, here is the configuration to set:
When using Unbound with forward-zones, does Unbound accept wildcards to help catch subdomains, or must every subdomain be specified by a separate forward zone?
Let's say there is a domain
example.com
with subdomains
s0.example.com
s1.example.com
s2.example.com
…..
s255.example.com
then which if any of the following names will catch all subdomains?
name: "example.com"
name: ".example.com"
name: "example.com."
name: ".example.com."
name: "*.example.com"
This might be considered very basic, but I have searched unbound.net, this site, and elsewhere without finding an answer. Thanks for help.
Try this:
local-zone: "example.com." redirect
local-data: "example.com. A 127.0.0.1"
queries for www.example.com and www.foo.example.com are redirected, so that users with web browsers cannot access sites with suffix example.com
source: https://www.freebsd.org/cgi/man.cgi?unbound.conf
You can also redirect .dev (choose whatever) extension to 127.0.0.1 for example:
local-zone: "dev." redirect
local-data: "dev. 10800 IN A 127.0.0.1"
this will redirect *.dev to 127.0.0.1 which is useful for web developers working with vhosts for example.
source: http://wtf.cyprio.net/wtf/2014-06-22-unbound-catch-all.html
I'm trying to redirect all sub-domains to the root domain. For example, my domain is www.example.com. When someone tries to connect to notexists.example.com, I want to redirect it to www.example.com.
This is first going to be limited to dns.
If DNS is not first setup then the client's web browser won't have an ip address to visit if no DNS records exist for that subdomain, so you will have no way of contacting apache for it to implement a server side redirection.
What you need is a wilcard subdomain/record. This is in the form of an A record:
* 14400 IN A 1.1.1.1
You will access to the httpd.conf file (root access), if you are using cPanel without root access add * as a subdomain:
https://www.namecheap.com/support/knowledgebase/article.aspx/9191/29/how-do-i-create-a-wildcard-subdomain-in-cpanel
If you do have access you will need to set up a virtual host - add the following to your httpd.conf file:
#
# Your VirtualHosts section
#
NameVirtualHost 1.2.3.4
##
# this one accepts any subdomain
##
<VirtualHost 111.22.33.55>
DocumentRoot /www/subdomain
ServerName hostname.domain.com
ServerAlias *.domain.com
</VirtualHost>
http://httpd.apache.org/docs/2.2/vhosts/
I'm interested in having my website show up for both of these urls - www.example.com and example.com. DNS works properly and redirects www.example.com to 184.72.232.XXX and shows the website but not example.com. I've tried 2 hostname setups:
www.example.com, canonical=true
*.example.com (unable to set canonical)
Both hostname configurations have the same result.
You'll need to add "example.com" too (and keep "*.example.com"). The wildcard only matches subdomains. If you want the www version to be the canonical hostname, you'll need to add that as well.