Is it possible to convert Dynamic URL to a cleaner, SEO-friendly URL

Hi,

I have created a dynamic link (set up as a Route) which filters the data on a html page by product_id parameter. The dynamic url looks like this:

https://abc123.com.au/tech-sheet.html?product_id=A36B:643766FD-7F8A-4224-B9F5-6BF2

This is the dynamic link binding for the url:

dmx-bind:href="'/tech-sheet.html?product_id='+SourceVarietyGSUID"

The Route has been setup as below:

Screen Shot 2020-09-21 at 10.11.31 am

Is it possible to convert the above dynamic url to a url as below for easy readability and SEO?

https://abc123.com.au/product_species/commercial_name

Both product_species and commercial_name are database fields that are fetched dynamically when product_id parameter is passed to the tech-sheet.html page.

I have checked the URL Rewrite docs to find a method to convert URL to a cleaner URL, however, none of the options listed in the documents seem to work for me.

Any help is greatly appreciated. Thank you :slight_smile:

Yes you can using routes. I’m on my phone right not so can’t provide a link but it’s in the documentation.

Hi @brad, thanks for your response.

I have tried the Route and Dynamic Link setup according to ‘Advanced Rewriting with URL Parameters’ option in the document, but it didn’t work correctly. The URL parameter displays correctly in the browser web address field, but it doesn’t display the html page correctly.

Is there any additional setup required in the source / target html pages?

Your path in your settings is wrong.

Path should be something like /tech-sheet/:product_id

Please review: https://docs.wappler.io/t/url-rewriting-with-wappler/6254#Advanced-Rewriting-with-URL-Parameters

Hi @brad, I have got it working now :slight_smile:

I made a mistake when setting up Dynamic Link value for the Anchor Button. I have now added one more parameter to it to make the url more meaningful.

Just one more thing I want to check; when I slugify one of the parameters in Dynamic Link value, the url stops working as the input url string value doesn’t match with the database value anymore. The parameter value SIOUX (PV 1202) displays like this in the url without slugify:

https://abc123.com.au/tech-sheet/A36B:4CFCE616-C76A-47F9-B8A8-6711/SIOUX%20(PV%201202)/

Could you please guide me where to add slugify transformation to make it work?

Thanks for your help :+1:t4:

1 Like

Well if you’re using the parameter to filter your database query it must be exactly the same as the database value.
If you are only using the first parameter: /A36B:4CFCE616-C76A-47F9-B8A8-6711/ to filter the query, then the second one is not needed and you can safely remove it from the query filters.

Hi @Teodor, I was trying to append product name to make the url more informative. I will remove the second param from the query and just use product id.

Thanks for your help @Teodor and @brad :slight_smile:

1 Like