_redirect file or redirect rule? - Redirect a saas custom domain to apex domain

Posted this pages discussions;got no help, sorry for retrying here:/ Using a _redirect file or a redirect rule, are they the same thing essentially?, one is a GUI and another is a text file? Ideally i want all cname that do not have a path of /dash to redirect to my apex domain. example: cname.yourcompany.com/dash -> shows mycompany.com/dash (this works) but if "cname.yourcompany.com" (user isnt logged in) then redirect to the customers apex your company.com" I have tried adding a redirect rule with a custom filter expression as so : (http.host ne "mycompany.com") then redirect to static "yourcompany.com" expected result is that if the http host is not equal to "mycompany.com" (e.g cname.yourcompany.com) then redirect to "yourcompany.com" (unless on /dash url path) So far this does not work and i am stumped 🤷‍♀️
4 Replies
Walshy
Walshy2w ago
Using a _redirect file or a redirect rule, are they the same thing essentially?, one is a GUI and another is a text file?
yep
I have tried adding a redirect rule with a custom filter expression as so : (http.host ne "mycompany.com") then redirect to static "yourcompany.com"
should work - what exactly are you seeing not work? it just doesn't redirect? got an example url? additionally, have you tried a trace? (also, redirect rules are best asked in #general-help since they aren't Pages)
Ricky U
Ricky U2w ago
What am i seeing not work - i will provide an example: My pages domain mycompany.com has cname setup for my customers (custom domain for saas i think its called also) docs.yourcompany.com -> mycompany.com (this works very well) But i only want for some paths like when the user is logged in at /dash or /account <these are authenicted paths> so i thiought i could use a redirect rule When the user visits a domain that is not mycompany.com/dash (i.e. docs.yourcompany.com) which is a valid custom domain setup on cf. it should redirect to something else (the reason is i dont want them to see my homepage) since essentitly they have white labelled my product. as a simple test, i have added this redirect rule (see pictures) It works only if the domain host is mycompany.com (pages project) but does not work if its a cname custom domain i setup (docs.yourcompany.com) Also I found trace, only works if the domain is my pages domain, but ifts a custom domain added to a pages project it does not trigger even when my rule is using a path in the search not a hostname.
hhf
hhf2w ago
for general redirection of all paths except authenticated ones: pattern: *docs.yourcompany.com/* forwarding URL: https://yourlandingpage.com to exclude certain paths like /dash and /account, you may need to create additional rules that specifically allow those paths before the general redirect rule.
Ricky U
Ricky U2w ago
thanks, but it seems redirect rules only work for the main domain name, but not for any custom domain setup which are located under the pages ->workers/pages -> custom domains.. hence i cant get any rules working for the custom domains here.. even simple rules wont work for the custom domains. without any wildcards..
Want results from more Discord servers?
Add your server