URL Rewriting with Wappler Problem

Followed the tutorial on this but running into, hopefully 2 little problems (proud to have gotten this far :slight_smile:) . I have the Main route added and also a page route so it displays when linking to the route like so:

19

I can click on the link in a repeat table and it opens the details page with the url path correct with the dynamic parameter:

00

When I refresh this page though it looses it’s ‘state’ and displays like this:

17

Besides the refresh problem how would I now use the dynamic value on the page?

1 Like

So it’s the server side routing you have issues with? What are your site links relative to? Is the base tag enabled?
What is generated in the htaccess file?

Not sure I understand this question :slight_smile:

Thanks for answering over the weekend @Teodor. Zipped and attached the files in question. The question you say you do not understand:

I have a id that I send using the url parameter as per the url rewrite tutorial. How do I use the id in the url to query data for instance. Id is 1 and I want it to return detail of the by filtering. So in short how do I bind the value to the page to use as get variable on server side.

Archive.zip (2.8 KB)

Hi Marcel,
I see something wrong in your routing setup.

Why do you have this defined as a main route and then as a page route?
Screenshot_5

Is this supposed to be a content page included in main page?
or
Is this supposed to be a separate page, which you call separately with url rewrite?

It is a content page that is included on the main page. I followed the tutorial on this and somewhere I maybe missed the plot. I tried it a couple of ways and this was the only setup that partially worked for me. It actually loaded the page and showed the url parameter.

It should not be on the serverside routing/url rewrite then!
There you have already defined the / to point to your main page. The rest should be loaded on the page in the client side routing.

Please remove the serverside routing for the campaigndetails.

1 Like

Ok, got this right! Bit of trail and error and one should so carefully follow the how to and not veer off course :slight_smile:

One thing that I might mention is that the field for the dynamic data/ID did not show immediately - I had to go out and back in. Might be that I had to update the route by pressing the up button. Nevertheless I have the link working and it passes the parameter and the page can refresh.

Now - how do I fetch that parameter from the URL to use in my query? Just on App Connect - I know what to do in Server Connect.

Hi Marcel, you can access the url params by using:

params.yourURLparam

1 Like

Ok, nevermind - got it:

browser componant
location function
pathparts array
count and use: browser1.location.pathparts[2]

ok - bit quicker your method! :slight_smile:

and more accurate should url length or syntax change