Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty redirects created when using CustomUrls #54

Open
Boddlnagg opened this issue Sep 17, 2015 · 8 comments
Open

Empty redirects created when using CustomUrls #54

Boddlnagg opened this issue Sep 17, 2015 · 8 comments

Comments

@Boddlnagg
Copy link

Whenever I create a new resource in one of my collections (see Collections Extra), Redirector creates an empty redirect to that resource, i.e. the pattern is empty and the target is [[~id]] where id is the ID of the newly created resource. This happens even though redirector.track_uri_updates is turned off.

I'm using Redirector 2.0.6.

@bertoost
Copy link

Fixed correctly using the "redirector.track_uri_updates" setting.
Cannot reproduce the empty pattern and the MODX link tag as target. It's also only storing non-dynamic URL's. Maybe some other plugin who break things? I tested with a clean install.

This will be available in the next update btw.

@Boddlnagg
Copy link
Author

Thanks for the fix! As far as the other issue is concerned: When redirects are created automatically on change of an alias, the target is always a dynamic URL for me (i.e. [[~id]]). I thought this was intended. The empty-pattern-redirects could also have to do with the Custom Urls Extra, which I'm using to rewrite the aliases for resources in my collections. Maybe OnDocFormSave CustomUrls generates an alias for me and then Redirector thinks that the URL has changed (but the old one is empty).

@bertoost
Copy link

Try it with temporary disabling the Custom URLs plugin. When it works by then, you know it ;-)

@Boddlnagg
Copy link
Author

Yeah, it definitely has to do with CustomUrls. Do you have any idea how to fix this, so the plugins don't interact badly with each other? (I considered changing the plugin priority of one of them, but it's not clear to me which one should run first to avoid any issues.)

@Boddlnagg Boddlnagg changed the title Empty redirects created for resources in collections Empty redirects created when using CustomUrls Sep 17, 2015
@bertoost
Copy link

Yeah that's definitely the way to fix it I guess.
Probably Redirector needs to run first, since it works with session values for old<>new URL's.

@Boddlnagg
Copy link
Author

If Redirector runs first, however, the alias change triggered by CustomUrls (which generated the alias based on the title in my case) will not be reflected in the Redirector rule. The optimal order would be:

  • Redirector reads old URL
  • CustomUrls generates a new one
  • Redirector uses new URL as target

I guess this is not possible? Therefore, it's probably better if CustomUrls runs first. Couldn't you still work around the issue with empty patterns by just checking whether the old URL is empty? There is no case where rules with empty patterns make any sense, right? So just skip creating the rule in such a case.

@bertoost
Copy link

Basically that's what is happening.. Redirector plugin also runs OnDocFormRender to store the current URL. When that one is changed against the new one (at save) it will create a rule.
Therefor I have will investigate together with Custom Urls next days

@Boddlnagg
Copy link
Author

This is still an issue which is slightly annoying, because I have to delete a bunch of empty redirect rules every once in a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants