Jump to content

image and script link not good because of subfolder


bblef91
 Share

Recommended Posts

Hi everyone!

I am new to ProcessWire and I have a simple question. I transferred from server to local one site and some images, scripts, and links to pages are not good.

Homepage is at "localhost/restaurant/release/" and for example link to some script is "/site/templates/scripts/f.js". So when browser tries to access this link it actually gets "localhost/site/templates/scripts/f.js" instead of "localhost/restaurant/release/site/templates/scripts/f.js" .

Where ProcessWire keeps this kind of stuff and how do I fix this?

Thanks ahead.

Link to comment
Share on other sites

Hello and welcome to the forum,

Is it possible that your template files use relative URLs? If so, the simplest fix might be to add the base tag to all pages:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

eg:

<base href="<?= $config->urls->templates ?>">

which should resolve to:

<base href="/localhost/restaurant/release/site/templates/">

or you can edit all your code to use something like:

<link rel="stylesheet" href="<?= $config->urls->templates ?>styles/main.css"/>

Hope this helps.

EDIT: the example base tag does not include the protocol.

EDIT 2: you probably do not use relative URLs :) So option two should be the way to go....

Edited by szabesz
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...