0

I have installed my Joomla website in localhost, server address is settle as "localhost", the site is working fine, I can browse through everything, the problem is that part of the layout is broken, also, there are images which are not loading. I searched for a solution everywhere, which I could not find, since this is a complex thing, here, let me explain it:

I have the following path settle /go/images/cupcakes.jpg in one of my articles, to display a cupcake image. When the website was up, it was working just fine. In localhost it isn't, why? Because I'm the site is installed in a folder, so whether there's an image relative path configured in a page or in the template, the site will refer to the root of localhost, not to the folder where the site is installed. So basically I should have installed the website in the root of htdocs folder in XAMPP, but I can't do that. How can I fix that, just so the entire Joomla framework knows that the folder where it's installed is the root folder and only point the relative paths to there? I would be able to fix that in a cPanel Linux server, but I'm totally lost in Xampp.

1 Answer 1

1

You've done the right thing in installing Joomla in a subdirectory rather than the root folder which XAMPP uses. This allows you to install multiple websites on your machine, one in each subdirectory.

Your problem is that your path /go/images/cupcakes.jpg is an absolute path rather than a relative path, which is indicated by the leading /. Joomla uses relative paths from the folder in which it was installed.

So if your cupcakes.jpg file is in the images folder under where Joomla is installed, then use "images/cupcakes.jpg" instead.

3
  • Thx. Well I can't use a relative path because, at least in that cupcakes case, the absolute path is settled in an external html file which is loaded inside the Joomla article. If I remove the slash, the file will be called from another place and the image will break.
    – 023023
    Commented Apr 2, 2020 at 7:26
  • I presume it's some software (a content plugin?) which is reading the file and inserting the paths into the articles. You could (1) change that software to convert the path to a relative path as it inserts it in the article (2) write another content plugin to post-process those paths, to make them relative (3) convert the other software to use relative filenames instead (4) set up rewrite rules in your local apache webserver (5) convert the html files to use relative paths and not use the other software on your machine. Not sure what's easiest for you. What do you want to achieve using xampp? Commented Apr 2, 2020 at 9:21
  • Sorry for the late reply. I'm going to be using xampp for while until I finish this project and host the website. Well, you talked about a plugin/software, but the same is also happening to the template and to images that are settle by Joomla core inside the articles. Also, the entire layout is broken.
    – 023023
    Commented May 5, 2020 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.