【发布时间】:2021-04-25 20:57:04
【问题描述】:
当我的自定义路线卷曲时,木材路线会抛出 404,如下所示。 GoogleBots 也将其视为 404 页。
λ curl -I http://mysite.test/this-is-a-test/
结果:
HTTP/1.1 404 Not Found
Date: Fri, 23 Apr 2021 03:44:00 GMT
Server: Apache/2.4.39 (Win64) OpenSSL/1.1.1b PHP/7.3.8
Strict-Transport-Security: max-age=31536000
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Link: <http://mysite.test/wp-json/>; rel="https://api.w.org/"
Content-Type: text/html; charset=UTF-8
虽然它在浏览器中运行良好。
我该如何解决这个问题?任何帮助将不胜感激。谢谢
代码示例
Routes::map('this-is-a-test/', function ($params) {
http_response_code(200);
echo 'Done'; // I also tried Routes::load('test.php', $params); both shows same result
exit;
});
【问题讨论】:
-
您能粘贴一些代码作为路线设置的示例吗?
-
添加代码示例
标签: wordpress twig wordpress-theming timber