However, when I published it all of the included files such as font-awesome.min.css are returning 404 errors because they still reference /~username/projectname on the production server.
So I’ve obviously done somethin wrong. I changed Links relative to = site root, it was document root.
like i said… i’ve probably done something wrong in the project setup. Looking at the code in wappler (sticking with my font awesome example): <link rel="stylesheet" href="fontawesome4/css/font-awesome.min.css" />
and it’s the same on the production server. which is correct.
My guess is the base href setting is causing this, looking at the source through firefox on both, this is set to ~username/projectnamefolder. It’s on every page. So what setting can i change to either A) make production update sub.domain.com or B) will remove it entirely?
That’s just what I used for my forum question. I have the actual url in my wappler project settings.
However, I didn’t add the production target until yesterday. I’ve noticed that new files created since I added it, do not have the base href tag in them.
I’m not sure what you mean, where do you define project root? What I do know is the web server URL setting (on Development target) is what’s causing it and doesn’t accept only a folder name, it requires a full url starting with HTTP or HTTPS. When I change this url it changes every:
I had to change Target to production, open every php page and save it. This caused the the meta tags to update to the production setting. Then I could hit publish and it uploaded to the server and worked.
That can’t be how wappler is intended to be done to publish a site?
my last attempt to see if i’m doing something wrong… when you change targets, should you have to save every page to ensure it updates the code for that target?
By the time i’m finished with this project i’ll have about 30+ php pages… to publish that would be a nightmare.
If i change the target to production and hit publish all the links, routing, etc are point to the development settings. so the site doesn’t work once it’s finished uploading.
To publish, I have to change my target to production. Open each php page i’ve created and save. I can watch the code as I do this and it changes the code to use the production settings.
Then and only then can I hit the publish button and it works as it’s supposed to. So either I’ve discovered a bug or something is wrong. It also could be because I’m on linux. I’ll open in windows and see if i can make the same problem appear.
This is the code when target it set to development and nothing changes when I select the production target. This is what will also end up on the production server if I hit publish. <html><head> <meta name="ac:base" content="/testingphp"> <meta name="ac:route" content="/"> <base href="/testingphp/"> <script src="dmxAppConnect/dmxAppConnect.js"></script> <meta charset="UTF-8"> <title>Untitled Document</title>
Once I update the target to production and then save the page, the code gets changed and publishing will work.
if i do, the code that is uploaded to the production server is wrong. it has references to the development environment causing links and routing to not work at all… <— This summarizes the whole problem.
Wappler doesn’t rewrite any of the files when switching targets and publishing.
The routes and links are being created when the file is saved. And the whole problem comes from the difference between the development and production targets. Locally you work in a subfolder in your server root, while on production it’s in the server root. That’s why the links are always wrong when uploading to the production.
Ok, I guess I’m confused. Should I need to manually edit the files after publishing? Just clicking the publishing button breaks everything once it’s on the production server. Unless I follow the steps I outlined above, wappler is publishing the code expecting ~username/projectfolder in each url and route, which doesn’t exist on the production server.
I get that. I understand the difference between my dev and production environments. When I’m writing vanilla PHP we use $_SERVER[‘DOCUMENT_ROOT’] and the code works between either by ensuring all referenced paths use Doc Root of the current server for links, etc. I’m using my home directory folder. My local environment is in my home folder. The production environment is using vhost config with a doc root set. It would never match and can’t believe anyone’s ever does.
All in all just trying to make sure I don’t have something set incorrectly. I’m about to add quite a bit more to this code base and the only way I’ve found I can publish is by opening each php page i’ve created, with the target set to production, and hitting save. Then I can publish because it updates the routes and urls to match the production target. I’m trying to make sure I haven’t set something incorrectly in the project settings. It’s very tedious to make it work