Publishing didn't change the url of the js file?

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.

Just tested in windows. Created a new local php project.

Here’s the development target:

Here’s the production target:

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.

    <meta name="ac:route" content="/">
    <base href="/">
    <script src="dmxAppConnect/dmxAppConnect.js"></script>
    <meta charset="UTF-8">
    <title>Untitled Document</title>

I don’t understand why code would change when switching targets.

Why switch targets? Just hit publish and push to remote server?

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

let’s just start over, with my question. Really excited about publishing this first part of the project for our team to use.

I’m on linux using apache. My development target is:
webserver url: http://localhost/~username/projectfoldername
access type is local folder.

Production target is linux running apache.
webserver url: https://sub.domain.com/

When I publish the code is expecting everything to be https://sub.domain.com/~username/projectfolder

How do i fix this?

Seems to be an issue that goes back for a while, posts about this go back to 2019 and something that won’t be corrected.

Found this comment:

AND this comment:

The code when published shouldn’t be trying to reference my developement folder structure especially if if my project is going to be at the root of a domain. I guess if you use xamp or wamp it would be.

If i’m missing something tell me, but radio silence isn’t cool at all. Just trying to understand this part of wappler.

Heya… I just discovered Wappler and before jumping on the train, I usually check the forums first what common problems happen.

My understanding on the different targets would be exactly the same as @stinknox has, and that’s how other environment settings work from my experience. I except Wappler doing exact the same: replacing the doc root with the settings from the webserver url (no matter if it’s a local folder, especially for many PHP / MAMP Environments) or my production server.

Otherwise: what’s the point of the setting then?

1 Like

@HeikoK That’s what i’m trying to figure out. Why the setting except to upload the files and why does it impact code?

It’s also peculiar that if I change the target to production, it updates the code and just uses / as the root. It doesn’t seem that it would be difficult to make this change to the code when using the publish option. This question/issue go back quite a while. It seems they have an opinion or hard coded themselves into a corner and don’t want to change it, that your folder structure should match on both targets. If your production is an actual domain that will never match.

Ultimately I could edit the .htaccess file to rewrite the url and remove the ~username/folder reference, but I shouldn’t have to do that.

However, don’t let this deter you from wappler. As a php developer, this greatly speeds my development time. I’m just working through some nuances and making sure I understand how it works. Don’t get me started on their server side arrays :laughing: (ranted about that a few times). Once i understand it better I’m hoping to create my first node project on it and start learning nodejs and docker better. Overall I think they’ve done a great job with it and everthing it does. I’ve tried somewhere around 14 low/no code builders and even with the issues like this, I still prefer using it learning laravel and writing every line of code myself. It’s the one that checked most of my boxes.

You know, I never was able to figure out why this works this way. My last contact with the Wappler crew they suggested I needed to change the XAMPP folder to the root folder on my local machine and pull everything out of the subfolder. Which is not how XAMPP works.

Hey. Did you ever figure out a way around this, cause I haven’t. What do you do?

I never found a fix. I don’t know if it was corrected in an update or it’s just not happening now. Are you having this issue now?

Yes. It’s a real pain. Having to resave everything. They have definitely missed the boat for those of us who use XAMPP. It doesn’t allow you to use the root folder. Have to have a subfolder. I do the same thing as you now. Yeesh.

I use Linux and apache. The problem happens no matter your development environment.

I just realized it hasn’t been happening with my current project. Not sure what I did different except I used the wappler server instead of my local apache install.

Now that is interesting.

Just confirmed, in my current project changing the target the meta tags for the routes are NOT changing. I just updated to 6.0.1 from 5.8. Not sure which version you’re on, I would try updating.

I should also add my project (and the project i initially started this thread about) are both PHP projects, not nodejs projects.

Had already update to 6.0.1. Am using PHP and MySql. The Meta tags do still change. Must be the Wappler server you are using. I publish to an IIS server.

Where do you access this?

Edit your target for development. It’s under server type I think is it what’s it’s called