【问题标题】:Different web domain and hosting不同的网络域和托管
【发布时间】:2023-03-28 10:52:01
【问题描述】:

我有没有托管的域“A”。我有托管域“B”。

我希望域“A”简单地拥有一个背景图像,它从域“B”托管中引用。

我在域“B”中建立了一个名为“bl”的目录在这个文件夹中,我放置了一个背景图像的 .jpg,“bg.jpg”以及一个带有 css3 代码的 style.css,用于拥有背景图片全屏。

如何将域“A”指向此特定文件夹。除了 style.css 和 .jpg 之外,我还需要其他元素吗?

如果有帮助,style.css 文件中唯一的内容是:

html { 
  background: url(http://mywebsite.com/bl/bg.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

感谢您的帮助。

【问题讨论】:

  • 你需要Absolute URL
  • 谢谢外星人先生。以及如何将域“A”链接到此页面。目前,当我访问 mywebsite.com/bl 时,那里没有页面。

标签: html css dns hosting


【解决方案1】:

在这种情况下,您需要为域 B 的图像提供绝对路径。这样,您可以在域 A 上调用它。

【讨论】:

  • 感谢您的快速回复。我怎么称呼它,我仍然不明白如何告诉'A'去'B'中的特定目录
  • 你能提供两个域名吗?我也会为你简化。
【解决方案2】:
<!DOCTYPE html>
<html>
<head>
    <title>Testing - Stackoverflow</title>
    <style type="text/css">
    html {
        background-image: url('http://blogsbits.com/wp-content/uploads/2013/01/Spring-Wallpaper.jpg');
        background-repeat: no-repeat;
        background-position: center;
    }
    .content {
        margin: 0 auto;
        width: 60%;
        margin-top: 100px;
    }
    </style>
</head>
<body>
<div class="content">
    <h1>Hi! Is This Usefull</h1>
    <p>You can use any image that in the world wide web site. I just do it for give you more example. Just copy this code and create a new html page in your localhost. I got that image from google search. You need to get the image full path.</p>
    <p><strong>Example : </strong></p>
    <p><a href="http://blogsbits.com/wp-content/uploads/2013/01/Spring-Wallpaper.jpg" target="_blank">http://blogsbits.com/wp-content/uploads/2013/01/Spring-Wallpaper.jpg</a></p>
    <p>This is the url that wich I viewed from google search engine. Click on it to view the image. Do the CSS styles also what type of you like</p>
    <p>Hope you can understand this.</p>
    <small>Wish you good luck on programming</small>
    <p><small>Yeshan Sachitha K Perera @ ITSthe1</small></p>
</div>
</body>
</html>

使用此源代码在您的本地主机中创建新的 html 文档并运行它。我希望你能理解这一点。

【讨论】:

    【解决方案3】:

    忘记域 B 的存在。这无关紧要。

    你需要:

    1. 将域 A 的 DNS 配置为指向运行网络服务器的服务器的 IP 地址
    2. 创建(在 Web 服务器配置中)一个新的 Virtual Name Host(这是 Apache 文档,如果您不使用 Apache,则需要为您的服务器找到合适的文档),并带有指向该目录的 DocumentRoot(在文件系统上。B的存在仍然无关紧要!)
    3. 添加 index.html 文件(您必须有一个网页才能显示背景图片)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-10
      • 2016-08-15
      • 2011-03-18
      • 2014-10-26
      • 2010-09-08
      • 2015-01-17
      • 2021-05-06
      • 2021-05-06
      相关资源
      最近更新 更多