I’ve got CustomRequest working fine with a specified resource, but can’t get it to work use a wildcard URL rather than a specific resource.
Ideally, I want this URL,and any other URLs that end with “speaker-info”, to strip off the last bit and send it as a request variable, “speakernamelink”. :
Your first solution (Alias Path = #.*?\/speaker-info# | URI Parameter = ["speakernamelink"]) should work.
If you have a resource with “alias” = speaker-info and “Container” = true, a request to https://yourdomain.com/2024/speaker-info/SpeakerName is forwarded to https://yourdomain.com/2024/speaker-info/ and the parameter “speakernamelink” is set to SpeakerName.
Update:
Yes, “container” has to be true! But why? It doesn’t have to be true if you specify a resource in the settings. The correct resource now loads. But, with “container” set to true, this also works: #.*?speaker-info# (without the initial slash).
When the code tries to find a matching resource, it adds a trailing slash to the alias (see the line of code linked below). I don’t know exactly why. But a trailing slash does also get added to container URLs (see column uri in the database table modx_site_content).
Maybe the code should be altered to also search for the alias without the trailing slash.