After modifying a site redirect from example.com
to example.com/something
the user can no longer edit that redirect entry (the page displays the flashing loading blocks)
I can update my previously entered redirect URL OR the UI should inform me that my original URL containing a subdirectory/page is invalid, thereby preventing me from saving.
The Support Docs suggest however that creating redirects with subdirectories is fine
https://en.support.wordpress.com/site-redirect/#getting-started
The page does not load.
Chrome/Firefox/IE
Domains: add site redirects for subdirectorys (sic) #7281
Framework: Force trailing slashes on all urls #117
Also, reported by user in #709617-zen
Is there any update on when this might be looked into?
I've done some investigation into this, and there are several issues; some related to the client side, however others go a little deeper.
We make a decision whether to allow a user to edit a domain using the selectedDomain
, which we pull from the routing params. In the url, this param is encoded, so the trick is to decode it on the front end.
This is where I got a bit stumped.
If a user tries to edit a redirect, he or she submits the edit redirect form, the page performs a POST to /sites/{:domain}/domains/redirect
and returns a success message.
The store admin for the user displays the new redirect.
The new redirect however doesn't work.
The GET response body from /sites/{:domain}/domains/redirect
only shows the original and first redirect url, saying that it's not enabled:
{
enabled: false
location: "this-is-the-original-redirect-url-that-never-updates.com/something/here"
}
The corresponding selected site (pulled from /me/site
and pushed into state.sites.items[ {siteId} ]
) also never reflects the changes.
The result is that, once set, a redirect url cannot be changed with any effect.
What are rules for updates to site redirects? Are they being silently rejected by the backend?
A side note so it doesn't get lost:
When clicking back after having edited a redirect url that contains a _trailing slash_, the previous component doesn't load.
It looks to be a front end issue and once again related to the url params. The extra slash appears in the url.
cc @klimeryk @aidvu to check if I've got it complete wrong 馃檪
Replied to 673093-zen to let the user know we are still investigating.
Thanks for investigating this, @ramonjd 馃檱
I now remember that I stumbled upon the same issue and narrowed it down to incorrect domain parsing in the URL, but was not able to quickly find out where it needs to be fixed, so I gave up. Your https://github.com/Automattic/wp-calypso/compare/fix/domain-redirect-subdirectory seems promising, so maybe you could create a PR from it and at least part of this bug will get fixed?
IIRC, we add the trailing slash either way, see p2MSmN-5yK-p2 for my investigation last time this was reported.
Bottom line is: site redirect is an often forgotten and neglected upgrade so I would not be surprised if some regressions crept in, especially wrt to Calypso.
PR #20495 closes this issue.
@ramonjd wrong PR in comment. 馃槢
Most helpful comment
Thanks for investigating this, @ramonjd 馃檱
I now remember that I stumbled upon the same issue and narrowed it down to incorrect domain parsing in the URL, but was not able to quickly find out where it needs to be fixed, so I gave up. Your https://github.com/Automattic/wp-calypso/compare/fix/domain-redirect-subdirectory seems promising, so maybe you could create a PR from it and at least part of this bug will get fixed?
IIRC, we add the trailing slash either way, see p2MSmN-5yK-p2 for my investigation last time this was reported.
Bottom line is: site redirect is an often forgotten and neglected upgrade so I would not be surprised if some regressions crept in, especially wrt to Calypso.