user882670
user882670

Reputation:

Joomla 3: Broken relative URL addressing images

I'm using Joomla 3.4.5 with SEF and .htacess with cache on.

The image URLs in modules and content are being incorrectly rendered. Sometimes, they are correctly displayed and some other times the following happens:

Instead of rendering:

www.domain.com/images/image.jpg

It is rendering:

www.domain.com/menu_item/images/image.jpg

I'm not sure why this is happening and if it is related wiht .htaccess or SEF, cache or everything.

I'm using the following custom redirects:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteEngine On
RewriteRule ^item/(.+)$ /artigos/$1 [R=301,L]

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>

Which I tried to comment out to check if it helped, but no luck.

Help anyone?

Upvotes: 2

Views: 739

Answers (2)

itoctopus
itoctopus

Reputation: 4271

In your backend, go to:

Components -> JCE Editor -> Editor Profiles -> Default-> Editor Parameters

and make sure that:

"File Directory Path" is set to "images" (without the quotes).

Save it and then clear your Joomla cache.

If that still doesn't work, then maybe the ordering of your plugins is wrong. Check this post we have written about 4 years ago (it is very old, but it is still valid): http://www.itoctopus.com/images-not-appearing-on-your-joomla-website .

Hope this helps!

Upvotes: 0

user4345221
user4345221

Reputation:

its about the image path.

for example:

/images/image1.jpg

refers to image in /website-rootfolder/images/image1.jpg

but

images/image1.jpg

refers to: currentUrl/images/image1.jpg

So with slash it means: load image from /root without slash it means: load image from /current url

hope it helps ;)

So for ur example:

www.domain.com/menu_item/images/image.jpg = images/images/image.jpg

just add the remaining slash / (/images/images/image.jpg) and your image on the page is getting loaded from:

www.domain.com/images/image.jpg

Upvotes: 1

Related Questions