Is there a way do to 301 redirects with a wildcard?

I have a page which takes parameters and such, e.g. :

domain.com/oldpage/mySlug?p1=true&p2=false

If I use the Bubble 301 redirect tool, it doesn’t catch the first page unless I make it exactly the same.

What I need is a wildcard that takes everything from the oldpage and sends it to the newpage, e.g. something like:

domain.com/oldpage/*domain.com/newpage/%1

Would result in:

domain.com/oldpage/mySlug?p1=true&p2=false
going to
domain.com/newpage/mySlug?p1=true&p2=false

Maybe you just need a Page is loaded event on the oldpage.
In this action, you navigate to the new page, with data to send as the current page data. Or if the oldpage doesn’t receive any data type, you need to construct the remaining section using
Get data from url (segment as list):item from #2:join with (/).

CleanShot 2024-01-02 at 17.48.59

@brenton.strine Consider using the event “User is logged in” instead so that the page resources are not loaded and the redirect happens faster. This is how Bubble handles server redirects. Make sure that you only use one action which is the Go To Page suggested by @an.tran

It’s important to be able to do a true 301 redirect (and not a page redirect) because the 301 status tells search engines that the content has moved to the new location, and isn’t just duplicated content.

Check with Bubble folks @brenton.strine

I believe 301 redirects work in tandem with server redirects.

Please do share with us what they say if you decide to touch bases with Bubble Support

What do you mean by “server redirects”?

(I mean, I know what a server redirect is, but I’m confused because I thought that the only server redirects that Bubble offered was the 301 redirect.)

Using “User is logged in” will not work if you want to redirect on a public page and the user hasn’t signed in. Bubble document specifies that my version of the event also emit a 301 response code.

1 Like

Cool @an.tran I did not mean that. You can also use the event When User is logged out … my suggestion is to avoid loading the page resources which happens on the page load event :smiley:

This topic was automatically closed after 70 days. New replies are no longer allowed.