Timeline for In event subscriber, how to redirect if value doesnt exist?
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 9, 2021 at 13:59 | comment | added | 4uk4 | My answer explains how Drupal makes redirects cacheable. If you insist on that your code runs on every page load, which practically means you don't want to cache the redirect at all, then first you have to take care of browser caching, they cache redirects quite aggressively, and second you have to disable the Internal Page Cache. See the comment on the topic I've linked at the end of the answer. | |
Nov 9, 2021 at 10:52 | comment | added | May | Hi, still not working. I think its a caching issue? It works some times, other times doesn't. Do I need to run on middleware instead or can I just update the code. I basically need the if statement checked on every page load. Thanks | |
Nov 8, 2021 at 17:21 | vote | accept | May | ||
Nov 8, 2021 at 14:28 | history | edited | 4uk4 | CC BY-SA 4.0 |
added 210 characters in body
|
Nov 8, 2021 at 14:27 | comment | added | 4uk4 |
The service path.current is updated during routing, this early you have to get the path from $event->getRequest()->getPathInfo() .
|
|
Nov 8, 2021 at 14:07 | comment | added | May | Edit: have updated code. What should happen is if visitor doesnt land on /MyModulePage to redirect them to /MyModulePage. But nothing is happening. | |
Nov 8, 2021 at 14:06 | history | edited | May | CC BY-SA 4.0 |
deleted 46 characters in body
|
Nov 7, 2021 at 21:52 | history | became hot network question | |||
Nov 7, 2021 at 17:15 | answer | added | 4uk4 | timeline score: 5 | |
S Nov 7, 2021 at 13:51 | review | First questions | |||
Nov 7, 2021 at 15:14 | |||||
S Nov 7, 2021 at 13:51 | history | asked | May | CC BY-SA 4.0 |