XF 2.1 Images In Pages?

b94

Member
I'm planning on going live with an XF 2.1 forum + website this weekend but have hit a problem that we didnt notice when testing (possibly as we tested on XF 2.0).

I have some xenforo pages with images on them setup with html as below:
HTML:
<img src="images/img.jpg">

Where images is a folder in the same directory as the forum. On XF 2.0/our previous setup this would work as all pages had the url: "/index.php?pages/page/" but now they all have the url "/pages/uni-guide/" which will cause the image url to become "pages/page/images/img.jpg"

What's the best way to go about fixing this? I'd rather not just change it to be "/images/img.jpg" in the html as then it wont work if the forum isnt in the root directory of the site as far as I know. Is there a way to relatively define the url?
 
This if XF is in the root:
HTML:
<img src="/images/img.jpg" />


This if in a directory:
HTML:
<img src="/community/images/img.jpg" />
 
  • Like
Reactions: b94
You could try this:

Code:
img src="../images/img.jpg

The ../should take the path back up a level in the folder hierarchy. For a folder in a folder: ../../
 
Top Bottom