JayGee Posted December 3, 2019 Share Posted December 3, 2019 Have read loads of similar threads but can't find the deifnitive answer. I'm bootstrapping ProcessWire into a Magento installation. Everything is working fine in terms of expected PW API functionality, however I cannot get the paths for images in the site work correctly. ProcessWire is installed in a subfolder called 'pw'. If I load the PW site directly e.g. visit mainsite.com/pw everything loads fine and all image paths are correct. If I load the parent site in the root folder with the PW bootstrapped page content rendered within it, the image paths don't contain the subfolder and so are broken. So I get https://mainsiteexample.com/site/templates/img/test.jpg instead of https://mainsiteexample.com/pw/site/templates/img/test.jpg I've tried updating the rewrite base in the .htaccess file but it doesn't seem to make any difference. Have also tried various settings in the config file to no avail. Wondering if rewrite base perhaps isn't working as intended because I'm behind a NGINX/Apache hybrid environment? Link to comment Share on other sites More sharing options...
wbmnfktr Posted December 3, 2019 Share Posted December 3, 2019 I really don't know if this might help here or if you already tried it but in version 3.0.141 Ryan made ProcessWire system URLs/paths now more customizable: https://processwire.com/blog/posts/pw-3.0.141/#processwire-system-urls-paths-now-more-customizable 1 Link to comment Share on other sites More sharing options...
JayGee Posted December 3, 2019 Author Share Posted December 3, 2019 Thanks @wbmnfktr - I did take a look at this and couldn't get anything working. I'm not sure at this stage if this is a server config issue my end or I'm not using ProcessWire as intended in this scenario. It seems to me that PW is grabbing site root from the parent page where the embedded bootstrap content is rather than the PW installation itself. Is this expected behaviour? Link to comment Share on other sites More sharing options...
wbmnfktr Posted December 3, 2019 Share Posted December 3, 2019 I honestly don't know. Never bootstraped ProcessWire into something in the last two years or installed it into a subfolder. Sorry. 1 Link to comment Share on other sites More sharing options...
JayGee Posted December 3, 2019 Author Share Posted December 3, 2019 Ah ha moment - I think I got it! Setting the root url in the template seems to have solved the issue. Although I think as per your post @wbmnfktr there's possibly a less destructive/repetitive way to this in future if can get my head round it! <?php $config->urls->root = '/pw/';?> 3 Link to comment Share on other sites More sharing options...
matjazp Posted December 3, 2019 Share Posted December 3, 2019 I could be completely off but maybe setting the path is not working correctly: https://github.com/processwire/processwire/pull/156 (related to https://processwire.com/blog/posts/pw-3.0.141/#processwire-system-urls-paths-now-more-customizable) Link to comment Share on other sites More sharing options...
dragan Posted December 3, 2019 Share Posted December 3, 2019 Can't you just use httpUrl instead of url? Link to comment Share on other sites More sharing options...
JayGee Posted December 3, 2019 Author Share Posted December 3, 2019 42 minutes ago, dragan said: Can't you just use httpUrl instead of url? That was my first thought too but it seemed to produce different output when bootstrapped vs loading as ‘native’ ProcessWire. Although I’ve now solved it, my hunch is still the rewritebase option in htaccess wasn’t working as intended. It could be because of the NGINX Apache proxy setup. For the record since I left the office for the day it dawned on me that the link @wbmnfktr posted above to Ryan’s updates on the customisable paths probably will work - but I think it may currently require the dev branch whereas this site is running master. Link to comment Share on other sites More sharing options...
JayGee Posted December 3, 2019 Author Share Posted December 3, 2019 (edited) 17 hours ago, matjazp said: I could be completely off but maybe setting the path is not working correctly: https://github.com/processwire/processwire/pull/156 (related to https://processwire.com/blog/posts/pw-3.0.141/#processwire-system-urls-paths-now-more-customizable) Interesting - I did try to call setLocation() from ready and init and both threw an error even though the blog post indicates they’re callable from there. Edited December 4, 2019 by Guy Incognito Typo that didn't make any sense! Link to comment Share on other sites More sharing options...
horst Posted December 4, 2019 Share Posted December 4, 2019 13 hours ago, Guy Incognito said: For the record since I left the office for the day it dawned on me that the link @wbmnfktr posted above to Ryan’s updates on the customisable paths probably will work - but I think it may currently require the dev branch whereas this site is running master. 13 hours ago, Guy Incognito said: Interesting - I did try to call setLocation() from ready and init and both three an error even though the blog post indicates they’re callable from there. Which pw version are you running? Link to comment Share on other sites More sharing options...
JayGee Posted December 4, 2019 Author Share Posted December 4, 2019 2 hours ago, horst said: Which pw version are you running? This site is 3.0.123. Link to comment Share on other sites More sharing options...
horst Posted December 4, 2019 Share Posted December 4, 2019 10 minutes ago, Guy Incognito said: This site is 3.0.123. Yep, I think the most tips above linking to the blog are only valid for greater pw versions. (Dev-Branch) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now