Comments (6)
You might be able to do this if you set up your webserver to redirect 410
status codes to Craft (the way you have it set up to do that for 404
status codes) and you set up the appropriate Twig template for that status code (again, like you did for 404
)
from craft-retour.
Hi @khalwat
Thanks for your help.
In the documentation, it is indicated to create a template with the status code. I've created these:
- 410.twig
- error.twig
- (gone.twig)
But I still get the same blank page
The 404.twig works correctly...
The server seems to be well configured:
HTTP/1.1 410 Gone
Date: Mon, 11 Mar 2024 08:49:26 GMT
Server: Apache/2.4.52 (Ubuntu)
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Cache-Control: no-cache, no-store, must-revalidate
X-Robots-Tag: none
X-Powered-By: Craft CMS
X-Debug-Tag: 65eec596750af
X-Debug-Duration: 97
X-Debug-Link: http://***.local/actions/debug/default/view?tag=65eec596750af
Set-Cookie: 0f76a97cf0214b90e8cddfdfd24c9509_identity=6a84e2d681f2e8519080cf7f534c5adb97072562b53036651841fcaf2e9e61a3a%3A2%3A%7Bi%3A0%3Bs%3A41%3A%220f76a97cf0214b90e8cddfdfd24c9509_identity%22%3Bi%3A1%3Bs%3A159%3A%22%5B1%2C%22%5B%5C%22F216pVZwW2YaaMu28Rd2dAIwAUsgEozA_4lKDybDxKtoGskn2ekItCq6xLzX_srzamVIM14m19Y2cGcUAv6jgii4sSBVQKEa5UgI%5C%22%2Cnull%2C%5C%22f7ec762ae3fce466b0ef48556c80eefd%5C%22%5D%22%2C3600%5D%22%3B%7D; expires=Mon, 11 Mar 2024 09:49:26 GMT; Max-Age=3600; path=/; HttpOnly
X-Content-Type-Options: nosniff
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Authorization
Access-Control-Allow-Methods: GET
Access-Control-Expose-Headers: Content-Security-Policy, Location
Access-Control-Max-Age: 600
Location: http://***.local/410
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
I don't know.
from craft-retour.
Further information
In vendor/craftcms/cms/src/controllers/TemplatesController.php in actionRenderError fct in line 240
dump($template);
dump($variables);
dump($this->renderTemplate($template, $variables));
exit();
And results
"_errors/410"
array:5 [▼
"message" => "Page non trouvée."
"code" => 0
"file" => "/media/DATA/www/***/vendor/craftcms/cms/src/web/Request.php"
"line" => 1350
"statusCode" => 410
]
craft\web\Response {[#442 ▼](http://www.***.local/accessoire/agrafe-a-piquer-#sf-dump-1909957779-ref2442)
-_events: array:1 [▶]
-_eventWildcards: []
-_behaviors: array:1 [▼
"template" => craft\web\TemplateResponseBehavior {#999 ▼
+owner: craft\web\Response {[#442](http://www.***.local/accessoire/agrafe-a-piquer-#sf-dump-1909957779-ref2442)}
-_attachedEvents: []
+template: "_errors/410"
+variables: array:5 [▼
"message" => "Page non trouvée."
"code" => 0
"file" => "/media/DATA/www/***/vendor/craftcms/cms/src/web/Request.php"
"line" => 1350
"statusCode" => 410
]
+templateMode: null
}
]
+exitStatus: 0
+format: "template"
+acceptMimeType: null
+acceptParams: []
+formatters: array:6 [▶]
+data: null
+content: null
+stream: null
+charset: "UTF-8"
+statusText: "OK"
+version: "1.1"
+isSent: false
-_statusCode: 200
-_headers: yii\web\HeaderCollection {#441 ▶}
-_cookies: yii\web\CookieCollection {#850 ▶}
+defaultFormatters: []
-_isPrepared: false
}
from craft-retour.
Did you set up your webserver to route 410 errors through Craft?
from craft-retour.
It's an Apache server. What do I need to configure?
Server: Apache/2.4.52 (Ubuntu)
from craft-retour.
I haven't used Apache in a long time, so I don't know off of the top of my head... but you'd want something in your .htaccess
to ensure that the webserver itself doesn't handle the 410
error, but rather it should be passed along to Craft so that it can then route it to the correct template.
Maybe this helps: https://stackoverflow.com/questions/65388979/properly-set-redirect-410-gone
from craft-retour.
Related Issues (20)
- Wrong `fileNotFoundUrl`in Dashboard HOT 5
- PDOException when url contains invalid UTF8 string HOT 5
- 404 data & redirect additions not displaying in control panel HOT 5
- Extra language parameter added HOT 1
- [Craft 3] One of retours migrations failed HOT 4
- Add logging of excluded patterns, and disallow empty patterns HOT 1
- Composer error when trying to upgrade to Craft 5 HOT 1
- Sort arrow is upside-down HOT 4
- Short link fields not working for external assets HOT 5
- Short Link field in table listing view causing error "Return value must be of type string, null returned" HOT 3
- Can't access plugin dashboard templates HOT 10
- Potentially valid redirects being deleted HOT 4
- Template Error When installing on Craft 3 HOT 1
- Integrity constraint violation errors being logged HOT 3
- Redirects list cached? Craft Cloud hosting. HOT 8
- 3.2.17 breaks website: Exception 'ParseError' with message 'syntax error, unexpected 'bool' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)' HOT 1
- URL gives 404 but is not logged in dashboard HOT 7
- Upgrading from 3.x to 4.x results in error HOT 4
- Wrong URLs in dashboard HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from craft-retour.