How to Automatically Add "https://" Prefix to URLs When Missing?

Hi Gliders,

I’m building an app where users need to input a URL that describes an offer. The URL is then sent to a Make.com scenario, where a scraper pulls the page content. The issue is that the scraper requires the URL to be correctly formatted with “https://”, and if users input an incorrectly formatted URL (e.g., just “www.example.com”), the scenario breaks.

I’m looking for a way to automatically add the “https://” prefix to URLs when it’s missing, so even if users don’t format the URL correctly, the app will adjust it before sending it to Make.com.

Can you suggest the most effective ways to do this in Glide?
Thank you very much!

HI @CarloA ,

Just from a basic understanding

Wouldn’t a if-else-if column and Template column to help you in this

Have a template column where input is https://URL

replace URL with the URL column

assuming you have a url column with name URL

you can pass it through a if-else-if column where you say

if URL includes https:// then → URL

if URL is empty then leave it blank

else ----> Template columns

If else if column looks like this

Template column will look like this

It might not be accurate but will get you results.

Regards,
Dilip

1 Like

You could use a JavaScript column with a regular expression:

return p1.replace(/^(?!https?:\/\/)(.*)/, 'https://$1');

4 Likes

The regex God with the clutch strike!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.