子域名更改图像路径 [英] subdomain changes image path

查看:104
本文介绍了子域名更改图像路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有后端控制面板的动态网站,其中包含用于数据输入的ckEditor。

ckEditor插入带有路径的图像: /userfiles/image1.jpg 当我打电话时要在用户界面上显示的页面,如果我从主网址访问它,则显示完美但由于某些原因,我们必须在子文件夹上移动几个部分,当我从该子域访问同一页面时,它无法显示图像。
b $ b当我查看图片的网址时,它显示如下:

app1.mysite.com/userFiles/image1.jpg

但实际路径是:
mysite.com/userFiles/image1.jpg。

I have one dynamic website with back end control panel which contains ckEditor for data entry.

ckEditor inserts images with path like: /userfiles/image1.jpg and when I call page to display on user interface it shows perfect if I access it from main url but due to some reasons few section we have to move on a sub folder and when I access same page from that subdomain it fails in displaying image.
when I checked url of the image, it shows like:
app1.mysite.com/userFiles/image1.jpg

But the actual path is:
mysite.com/userFiles/image1.jpg.

有什么技巧或技巧可以解决这个问题吗?

我正在使用PHP。

Is there any trick or technique to solve this?
I am using PHP.

推荐答案

您可以定义< base> < head> 中的code>:

You can define a <base> in your <head>:

http://www.w3schools.com/tags/tag_base.asp

用PHP做事很难。事先将其更改为绝对URL可能是最好的方法,之后更改它意味着HTML扫描,查找图像,检查网址是绝对的还是相对的,并在需要时更改它。

To do ist with PHP is hard. Changing it beforehand to an absolute URL might be the best way, changing it afterwards means HTML scanning, finding the images, check wether the url is absolute or relative and change it, if needed.

这篇关于子域名更改图像路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆