子域和文件夹

发布于 2024-08-04 20:16:19 字数 788 浏览 5 评论 0原文

刚刚启动了一个网站,我在主域上有一个 /img 目录。我想设置一个能够使用 /img 文件夹的子域(其中文件夹只是主目录中的另一个文件夹),但它不起作用。

/img/subdomain 文件夹位于同一级别,因此要在主域中显示图像,我输入: 对于 /subdomain 我输入: 我收到该网站的 404 错误: http://subdomain.example.com /img/image.jpg 如您所见,我希望它链接到http://www.example.com/img/image.jpg

谁能告诉我如何实现这一目标? 我不想将图像链接到他们的互联网目录(即 http://www...),因为我想修改网站我的电脑并通过 ftp 将它们上传到我的由 bluehost.com 托管的网站。

我确信这只是我搞砸了或者不完全理解的事情。提前致谢!

Just started a site and I have an /img directory on the main domain. I would like to set up a subdomain(where the file folder is just another one in the main directory) that is able to use the /img folder, but it doesn't work.

The /img and /subdomain folders are on the same level, so to display images in the main domain I type: <img src="img/image.jpg">
and for the /subdomain I type: <img src="../img/image.jpg">
and I get a 404 error for the site: http://subdomain.example.com/img/image.jpg As you can see, I want it to be linking to http://www.example.com/img/image.jpg

Can anyone tell me how to achieve this? I would prefer not to link images to their internet directory (i.e. http://www...) because I would like to modify the sites on my computer and upload them via ftp to my site hosted by bluehost.com.

I'm sure it's just something that I am messing up or don't completely understand. Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

枫林﹌晚霞¤ 2024-08-11 20:16:19

在 Web 服务器上的文件夹结构中,创建指向目标 /img 的符号链接 /subdomain/img

在 Linux 中,可以通过以下方式完成:

cd /your_web_folder/subdomain
ln /your_web_folder/img img -s

In your folder structure on your web server, create a symbolic link /subdomain/img pointing to the target /img.

In linux, this can be done by:

cd /your_web_folder/subdomain
ln /your_web_folder/img img -s
远昼 2024-08-11 20:16:19

不要使用子域进行资产管理。从企业的角度来看,您最终将拥有数百个子域,并且不知道每个子域代表什么。我知道这听起来很荒谬,但我已经看到它发生了。

我强烈建议使用经过深思熟虑的目录结构来平衡资产类型与版本控制信息。我还建议使用内容分发系统,例如 Edgesuite 网络。

Do not use subdomains for asset management. From an enterprise perspective you will end up with hundreds of subdomains and have no idea what each represents. I know this must sound absurd, but I have seen it happen.

I would strongly recommend using a well thought out directory structure that balances asset types against versioning information. I would also recommend using a content distribution system, such as the edgesuite networks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文