大网数据广告活动
网站运营与故障问答

I have a CNAME for www, how do I redirect root domain there?

· 52CE 我爱测

My DNS setup is rather simple: a CNAME for www , default (registrar's) nameservers for the root. Now I want to redirect from the root domain to www, which I thought would be a simple task, but it's not working. I've followed ever…

问题原文

原帖链接 · Yeats · CC BY-SA 3.0

My DNS setup is rather simple: a CNAME for www, default (registrar's) nameservers for the root.

Now I want to redirect from the root domain to www, which I thought would be a simple task, but it's not working.

I've followed every guide out there on how to change the htaccess file and my registrar is even offering a simple setting to do this as well, but no result. When I go to the root of my domain in a browser it instantly says:

mydomain.com's server DNS address could not be found.

What's the right course of action here? Should I add a server alias? A domain alias? Should I add some records to my DNS settings? I'm out of ideas.

Note: I do not have a static IP address for my server. Rather, I need to direct requests to my server using a CNAME record.

已采纳解答

原帖链接 · EEAA · CC BY-SA 3.0

You need an A record for your domain root, pointing to the IP address of your server.

Only once you have that in place (thus directing requests for example.com to your server) will your .htaccess rules take effect.


Since your server does not have a static IP address, you will need to find out if your DNS provider supports ALIAS or ANAME records. These allow you to have CNAME-like functionality at the zone apex. If your provider does not support these records types, you should be able to move to a provider that does support them without significant effort.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。