Struggling with routing

Hi guys - just moved over from Bubble and been having a play about with Wappler over the last few days. Very impressed with everything so far, and I’m finding it a lot more flexible than Bubble.

I have read through the routing documentation, but I’m hitting a blank here. First off I’ve set up my routing as per the first screenshot

routes.

I think everything is looking okay here, which produces the following .htaccess file.

Form the off, I’m getting 404 errors when trying to load any page. I’ve edited the .htaccess file to include a / in front of the php filename, which is solving the issues to a degree, but this only works when its not nested e.g. /customer-management works, but not /manager/customer-mangagement - in this case with the /*.php all I’m getting is a redirect to /manager.

Thanks for taking the time to read through - and any advice would be greatly appreciated.

Craig

Could only post one image. Here’s the .htaccess

Hi @craigb !

You should not need to edit the .htaccess file directly when it comes to routing.

Is your project set up to be relative to document or relative to site?

Hi @scott, thanks for the fast reply! I’ve currently got it set up as relative to document

Thanks

Craig

ok, when you are loading the page, how are you access the page? Are you going through a link that you have inserted on a page or are you accessing it directly by typing in the routing url?

For example in your image, you have /manager/customer-management, did you type in example.xyz/manager/customer-management/

@scott typing directly into browser address bar

ok please provide a screenshot of the bottom half of the routing section, showing the settings for the link in question.

Additionally, you will need to reset the .htaccess to its default setting.

@scott. Here is the routing properties for /manager/customer-management

routeproperties

I have reset the .htaccess file back to wappler’s uploaded version.

Thanks

ok, everything looks good, so now we can look at the actual error being received. Please open the custman.php page and look at the code, make sure there is a base reference towards the top.

Please visit the page directly using example.xyz/manager/customer-management and see what happens.

The following is in the head of the file

<base href="/">
<meta name="ac:route" content="/manager/customer-management">

If I go to the url directly, example.xyz/manager/customer-management, I get the page set as /manager rendering, which is manager.php

Ok, remove the /manager page from the routing and try again.

To clarify, keep the /manager/customer-management one, but remove the /manager one.

@scott - keeps displaying manager.php but retaining the url of /manager/customer-management

Odd, let’s try this, remove all routing from Wappler, click on the upload icon in the routing panel.

Open the .htaccess file to ensure all routing has been removed.

Then add just the customer-management routing and test again.

Okay, just cleared all routes, generated and uploaded but the following still remains:

RewriteRule ^/?manager/customer-management/amend(?:/)?$ custman-amend.php [QSA,NC,L]

ok, just delete the entire .htaccess file, it will be recreated when you add the routing again.

Okay, this is weird. Deleted file completely, re-uploaded routing rules, but that line remains

Are you testing locally or remotely? Make sure the file is completely deleted on both ends.

Closed Wappler, re-opened and its now showing the amend route rule. I’ll delete and try again.

@scott I’m testing remotely, deleted both .htaccess which has removed the erroneous line. Checked the new .htaccess with the single above rule, its there, but its still directing to my manager.php page.

So odd when you remove the file, it should remove the reference as well.

Do have an routing setup in CPanel (or whatever software you use on the server to manage the site)?

@Teodor, any suggestions?

1 Like