简体   繁体   English

无法在子域上链接图片

[英]Cant link images on subdomain

Can someone explain why linking local image files doesnt work under subdomain. 有人可以解释为什么在子域下链接本地图像文件不起作用。

I have a website: 我有一个网站:

http://example.com/site/index.php http://example.com/site/index.php

Icons and images are under icons directory. 图标和图像位于icons目录下。

http://example.com/site/icons/icon.png http://example.com/site/icons/icon.png

I include them in site like this: 我将它们包括在这样的网站中:

<img src="icons/icon.png">

This works fine when accessing site from first url. 从第一个URL访问站点时,此方法工作正常。

However, when i use subdomain: 但是,当我使用子域时:

http://site.example.com http://site.example.com

Icons doesnt display anymore. 图标不再显示。

I notice that even in browser, it doesnt exist. 我注意到,即使在浏览器中,它也不存在。

http://site.example.com/icons/icon.png http://site.example.com/icons/icon.png

Happy new year! 新年快乐!

You need to check where your subdomain is pointing to. 您需要检查子域指向的位置。 It seems from your description that the folder which it is pointing to contains an index.php file that is identical to the index.php file in the site folder, which gives you the feeling that the subdomain is actually pointing to the site folder, but it's not. 从您的描述看来,它指向的文件夹包含一个index.php文件,该文件与site文件夹中的index.php文件相同,这使您感到子域实际上指向site文件夹,但是不是。

You need to change the subdomain in the control panel to point to the value /site . 您需要在控制面板中更改子域以指向值/site Notice the forward slash. 注意正斜杠。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM