Hello there, I have my redirects file set but every time I hit Unsubscribe, it redirects back to the main /blog page.
Here’s the rule I’ve added to try to prevent this:
{"permanent":true,"from":"^/(?!unsubscribe/?$)([A-Za-z0-9\\-]+)","to":"https://mypage.blog/"}]
But it didn’t work at all. The goal here is, every time someone hits a link like: https://ghost.mycompany.url/unsubscribe/?uuid=e469692b-bd58-4e43-8ba1-de2162c45d03&newsletter=3cceaa94-9705-40ae-b261-3cf052781dec
It should go to actually to the /unsubscribe/ and not to https://mypage.blog/, which everything else should be going to.
I’m confused.
It sounds like you are saying that when someone visits /unsubscribe/ they should go to /unsubscribe/ … in which case no redirect is needed.
Are you trying to control where people get sent after they the unsubscribe link and the unsubscribe action is completed?
Quite the opposite, I don’t want to redirect people to the main page when they go to /unsubscribe, the current behavior. So if they hit https://ghost.mycompany.blog/unsubscribe/* they SHOULD go there, and not redirect back to https://mypage.blog/, the original rule was:
{"permanent":true,"from":"^/([A-Za-z0-9\\-]+)","to":"https://mypage.blog/"}]
That’s why I added the ?!unsubscribe/?$
on it, to maybe prevent this path redirecting, but didn’t work.
I tested going to /unsubscribe/ on a couple of my Ghost blogs and it doesn’t redirect, it returns a simple page that says “email not found”.
Have you created a custom “unsubscribe page” that you are trying to use instead of the built-in experience?
Nope, I haven’t, it’s the URL response when clicking on “Unsubscribe Newsletter”, I actually don’t know the exact behavior, should it return a pop-up or a warning about the unsubscribe action?
I haven’t tested unsubscribing recently.
I presume if you are subscribed, there’s acknowledgement that the action completed successfully, but maybe if you are already unsubscribed, you just get redirected to the home page (because there’s nothing to do).
Well, but I have the feeling that this is preventing users to unsubscribe to mine newsletter, there are some complains, I’m checking on the database events for members and logging and seems thats to be the case
Unsubscribing definitely works without the installing any special redirects. The problem must be elsewhere.
Still no clue at all.
{"permanent":true,"from":"^/(?!/unsubscribe/*).*$","to":"https://company.site\
/blog/"}
Still getting redirect. Look the curl response:
curl https://ghost.company.site/unsubscribe/\?uuid\=e469692b-bd58-4e43-8ba1-de2162c45d03\&newsletter\=3cceaa94-9705-40ae-b261-3cf052781dec
Moved Permanently. Redirecting to https://company.site/blog/?uuid=e469692b-bd58-4e43-8ba1-de2162c45d03&newsletter=3cceaa94-9705-40ae-b261-3cf052781dec
Current solution, updated the whole file to one single line:
[{"permanent":true,"from":"^/(?!unsubscribe/.*?)([A-Za-z0-9\\-]+)","to":"https://company.site/"}]
Now unsubscribe works, the problem is that, if someone hits ghost.company.site
it does not redirect to company.site/blog
But we can fix that on NGINX I guess