Relatively new to D8. Just moved a site from a staging environment to a local environment to map onto and work on a project. After moving the site, all the image paths are broken and some of the js features don't work. I could solve this by hardcoding the local dev paths to fix the broken content relationships in the blocks, but this is tedious and will cause a headache later.

Where does the local site path get specified and why aren't the relative paths working?

  • Are you sure the paths are wrong? Have you checked that the files are actually there? Maybe you didn't copy all the files. Or more commonly when moving between systems it's a files and folders permissions issue: Securing file permissions and ownership. There is a summary of permissions and ownership at the bottom of the article, and a script if you want to use (works with D8 too). – prkos Dec 4 at 15:50
  • No, when I hard code them they appear. – nizz0k Dec 4 at 15:51
  • Is there a difference in where the drupal folder is installed between systems? Check your .htaccess and settings.php for rewrite rules, baseurl and similar options. It would help if you included examples in your question. Is CSS loading? CSS and JS files usually behave similarly WRT paths and permissions. – prkos Dec 4 at 16:02
  • The last comment here might be relevant: Localhost. Problem with relative path to images. – prkos Dec 4 at 16:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.