消息之间的区别:'服务器返回404'和'找不到GET / routeName的路由(Difference between messages : 'server returning 404' AND 'No route found for GET /routeName)
windows 8. symfony 2.7安装在d:\ htdocs \ sym \ again \ blog \
哎呀! 发生错误服务器返回“404未找到”。 东西坏了。 发生此错误时,请告诉我们您在做什么......
信息:上述错误与常规apache 404'找不到对象'消息不同。 对于http:// localhost / NonExistingPage
使用内置的PHP服务器php app/console server:run ,
找不到“GET / NonExistingRoute”路由404 Not Found - NotFoundHttpException 1链接异常:ResourceNotFoundException»
问题:错误之间有什么不同? 我的理解:
常规的apache错误就是当一个文件被请求时,不被apache发现
'哎呀! 发生错误服务器返回“404未找到”。 有什么东西坏了'是什么让我困惑,我不明白为什么/它如何不同于没有发现错误的路线。
未找到的路由表示它已到达symfony,但未在路径文件中找到任何匹配/ NonExistingRoute的路由。
另一个奇怪的事情:
如果routing.yml更改为:
offtopic_books_homepage:
path: /sym/again/blog/web/hello
defaults: { _controller: OfftopicBooksBundle:Default:index }
然后
http://localhost:8000/sym/again/blog/web/hello - 返回期望的页面。 (使用app / console运行)
而http://localhost/sym/again/blog/web/hello - 提供以下错误:
哎呀! 发生错误服务器返回“404未找到”。
为什么?
windows 8. symfony 2.7 installed with default settings on d:\htdocs\sym\again\blog\
With apache, running the URL: http://localhost/sym/again/blog/web/hello , returns the following error:
Oops! An Error Occurred The server returned a "404 Not Found". Something is broken. Please let us know what you were doing when this error...
INFO: The above error is different from regular apache 404 'object not found' message. for http://localhost/NonExistingPage
With the built in PHP server php app/console server:run,
No route found for "GET /NonExistingRoute" 404 Not Found - NotFoundHttpException 1 linked Exception: ResourceNotFoundException »
while running the URL http://localhost:8000/hello, returns the actual page.
Question: What is the different between the errors ? My understanding:
the regular apache error is simply when a file is requested that is not found by apache
The 'Oops! An Error Occurred The server returned a "404 Not Found". Something is broken' is what is confusing me, I don't understand why/how it is different from the route not found errors.
the route not found means that it reached symfony but did not find any route matching /NonExistingRoute in the routes file.
Another Strange thing:
if routing.yml is changed to:
offtopic_books_homepage:
path: /sym/again/blog/web/hello
defaults: { _controller: OfftopicBooksBundle:Default:index }
then
http://localhost:8000/sym/again/blog/web/hello - returns the expected page. (with app/console running)
Whereas http://localhost/sym/again/blog/web/hello - gives the following error:
Oops! An Error Occurred The server returned a "404 Not Found".
Why ?
原文:https://stackoverflow.com/questions/32266158
更新时间:2021-01-15 18:01
最满意答案
在这种情况下,请为prod重置缓存:
php app/console c:c -e prod
注意:请使用dev env和app_dev.php进行开发,而不是生产环境。
In this case please reset cache for prod env:
php app/console c:c -e prod
Note: Please use dev env and app_dev.php for development, not production environment.
相关问答
这似乎是FormData对象的一个问题。 一旦我改变了我的方法来使用.serialize()来代替,页面就可以正常工作。 $("form#applyform").submit(function(){
var data = $("form#applyform").serialize();
jQuery.each($('#file')[0].files, function(i, file) {
data.append('file-'+i, file);
});
...
我可以看到你有密码/电子邮件的POST路由。 你有密码/电子邮件的GET路线吗? 你得到404因为它试图访问GET路由。 I can see you have POST route for password/email. Do you have a GET route for password/email as well? You are getting 404 because it is trying to access GET route.
您在服务器上的储蓄路线设置为/savings/savings而您的表单正在呼叫/savings 。 请更改表单或更改服务器端: 在saves.js中 ,更改 router.get('/savings', function(req....
至 router.get('/', function(req....
此外,您正在使用get提交表单。 也许你需要改变它 router.post('/', function(req...
Your savings route on the server is
...
从这改变你的路线定义: router.post("/login", ...)
对此: router.post("/", ...)
/login已经在这里指定: app.use("/login", login);
这意味着路由器中的所有路由都已经以/login作为前缀。 所以,你的代码正在为/login/login创建一个不是你想要的路线。 仅供参考,您也可以从此改变: app.use("/login", login);
对此: app.use("/", login);
尽管将整个登录路由
...
我认为关于'middleware'=>'csrf'的问题。 I think issue on 'middleware'=>'csrf'.
如果您使用nodejs服务器来提供页面,您是否在应用程序中使用了html5Mode(true)? 否则,您需要将散列添加到您的定位标记。 即 Assignments
另外,由于您正在使用ui-router,因此可以使用ui-sref属性直接导航到状态名称。 即 Assignments
If you are using a nodejs server to serve up the
...
在这种情况下,请为prod重置缓存: php app/console c:c -e prod
注意:请使用dev env和app_dev.php进行开发,而不是生产环境。 In this case please reset cache for prod env: php app/console c:c -e prod
Note: Please use dev env and app_dev.php for development, not production environment.
您需要更新服务器上的classroom.js文件的一部分以使用post方法: router.post('/edit', function(req, res, next) {
console.log('A flag was edited...');
pool.query("UPDATE classroom SET flagreason = '"+req.body.flagreason+"' WHERE id = '"+req.body.id+"'", function (err, res
...
刚刚将root更改为/ var / www / html / lar / public,然后路由正常工作 Just Changed root to /var/www/html/lar/public, then routes works properly