简体   繁体   English

Laravel路由在Web主机中不起作用

[英]Laravel routes not working in web host

I have uploaded laravel project to shared hosting, Main page working so this: 我已经将laravel项目上载到共享主机,主页工作如下:

Route::get('/','PageController@index'); 

works but this: 可行,但这:

 Route::get('/stories', 'PageController@getStories'); 

doesn't work.404 not found error 不起作用。404找不到错误

Generally all other routes not working except this 通常,除此以外,所有其他路线均无效

 Route::get('/','PageController@index'); 

ssh acces is not possible to web hosting.Can anyone help me What is problem? ssh acces无法进行网络托管。任何人都可以帮助我。什么问题?

Try : 尝试:

http://yourdomain.com/index.php/stories

Please check htaccess wnabled for your hosting or not. 请检查htaccess wnabled是否为您的主机。

您的虚拟主机必须启用mod_rewrite。

you have to remove / before stories. 您必须先删除故事。 try to write 尝试写

Route::get('stories', 'PageController@getStories'); 

If you use http://domain/stories to access route '/stories', try to see if http://domain/index.php/stories works for you. 如果您使用http:// domain / stories访问路由“ / stories”,请尝试查看http://domain/index.php/stories是否适合您。 If it does, your htaccess is not working properly. 如果可以,则您的htaccess无法正常工作。 Usually, shared hosting does not have rewrite engine enabled for apache. 通常,共享主机没有为Apache启用重写引擎。

My problem was I was using temporary domain which was given by shared host, after domain name propagated (as shared host saying) all routes worked. 我的问题是,在域名传播后(如共享主机所说),所有路由均有效,我正在使用由共享主机提供的临时域。 Thanks for answers 谢谢答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM