I tried to add another error page to also catch 410 errors. I created a new 410-folder and an error.md file inside it.
Now I‘m stuck. How can I get the error plugin to display my custom 410-error-page, when an URL is called which I have declared as being gone in the .htaccess file?
Great you are using this status code, most site owners don’t bother. It’s an important HTTP status!
Sounds like you followed directions in the README. Looking through the plugin code, I can’t see how that is triggered, so I have to question their accuracy.
Can you tell if your “gone” pages are being processed by Grav at all? It seems to me that if .htaccess is followed, Grav is left out. If you leave it to Grav, you don’t have a way to know it’s 410.
I can see a way this plugin could be extended or hacked if you want to go that way. The plugin uses the hook onPageNotFound, where you could probably check against a list of “other status” URLs (obtained from plugin config rather than .htaccess). Then alter the headers appropriately and load the right page/template. Is that something you’d be comfortable hacking?
This plugin lets you record a list of intentionally deleted routes. When those routes are requested, it emits a proper 410 GONE code instead of the more vague 404 NOT FOUND
You can investigate how @Perlkonig handle 410 errors
Now, when I delete the ‘ErrorDocument’ line gone pages will result in the standard ‘Gone’ error message of the webserver. So far so good.
As soon as I add the ‘ErrorDocument’ line to the ‘.htaccess’, gone pages will result in the ‘404’ error message configured in the Grav Error plugin - instead of my ‘/410’ page.
When I call ‘/410’ page directly it displays perfectly well.
@dimitrilongo
I installed the Graveyard plugin. It sounded promising in terms of comfortable maintenance. The plugin works like a charm for specific URLs, but unfortunately it doesn’t give me the flexibility of defining URLs like ‘/aggregator/’ or ‘/posts/*’ to catch all the pages starting with a certain pattern. This fact leaves this plugin useless for my scenario, because I don’t even know all the possible URLs to put into that list.
I don’t think maintaining a list of specific URLs is a comfortable and flexible way for me to go as I don’t even know all the possible URLs at the moment.
Therefore I would like to rely on the flexibility ‘.htaccess’ gives me. Is this possible by any chance? I thougth the Error plugin would enable me to do just that …
If you use htaccess, then Grav has nothing to do with it. You just need to make sure it plays nice with the Grav root htaccess.
There’s no reason I can think of why the plugin couldn’t be expanded to use wildcards. I just never thought of it at the time. I’ll take a look later today. Pull requests are also welcome.
I’d love to help, but my php knowledge is quite limited, so I wouldn’t even know where to start … I’m afraid. But if I can be of any help as ‘beta tester’ - just let me know. ;o)
You can’t just put a trailing slash. That second one needs to be - /node/*. I didn’t test with query parameters. They shouldn’t matter. You should just have to do - /external and be done with it (no wildcard needed). But I’ll double check later today.