douxunzui1519 2015-10-27 09:13
浏览 105

如何配置域名的DNS记录以指向同一IP地址?

My website behaves differently with http://example.com and http://www.example.com. I know these are considered as two different domains. But what do I do to fix this issue? People will mostly type example.com instead of the full url, therefore what should I do so that the two urls' point to the same website?

  • 写回答

1条回答

  • duanliaogui4133 2015-10-27 09:28
    关注
    • First thing that you need to do is to make sure that DNS server has records for both of those domains pointing to the same server (A records).
    • You need to add bindings for those two addresses to point to the same web application in the web server settings (In case of IIS you will need to add multiple bindings on Edit Site menu)
    • In case you need to redirect HTTP to HTTPS you can use IIS rewrite module with the following rule

    Rule

    <rule name="RedirectToWWW" enabled="true" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern=".*your-domain\.com" />
                    <add input="{HTTP_HOST}" negate="true" pattern="www\.your-domain\.com" />
                </conditions>
                <action type="Redirect" url="https://www.your-domain.com/{R:1}" redirectType="Permanent"/>
    </rule>
    
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿