简体   繁体   English

Laravel上的路由不断重定向(301)到网站的根目录

[英]Route on Laravel keeps redirecting (301) to root of website

I have an application using the A2 host provider, and inside the public directory its my laravel folder (www.website.com/app) 我有一个使用A2主机提供程序的应用程序,并且在公共目录中有我的laravel文件夹(www.website.com/app)

And in my server preferences I am redirecting the root "/" to "/app" 在服务器首选项中,我将根目录“ /”重定向到“ / app”

The app was OK, but today started to redirect a Route in specific.. 该应用程序还可以,但是今天开始特定于重定向路线。

  Route::get('/postagens/{Alias}/{dataInicio?}', array(
        'as' => 'artista.get.posts.all',
        'uses' => 'ArtistaController@getPostsMainFeed'
    )
);

Inside the generated HTML, it makes: http://www.website.com/app/artista/posts/twitter/ but when I access this address or send request via jquery, it redirects me to http://www.website.com/artista/posts/twitter , and that gives me a 404 (because There's no laravel app inside root...) 在生成的HTML中,它的内容为: http : //www.website.com/app/artista/posts/twitter/,但是当我访问此地址或通过jquery发送请求时,它会将我重定向到http://www.website。 com / artista / posts / twitter ,这给了我404(因为root内没有laravel应用...)

All the other Routes still working... 所有其他路线仍在运作...

Any Idea? 任何想法?

Thanks 谢谢

Editing 编辑中

I inserted the wrong Route here, but BTW, I "solved" this by making the route without the second parameter, and adding it on the javascript instead using laravel URL::route. 我在此处插入了错误的Route,但是顺便说一句,我通过不使用第二个参数的路由来“解决”此问题,并将其添加到javascript中,而不是使用laravel URL :: route。

I was having the same problem trying to reach a route on the provided AuthController. 我在尝试到达提供的AuthController上的路由时遇到了同样的问题。 It turned out to be middleware set in the constructor that I didn't see. 原来是我没有看到的在构造函数中设置的中间件。

$this->middleware('guest', ['except' => 'logout']);

Which was 302-ing non-guests to the root page, even for the logout route despite being an exception. 尽管有例外,但即使对于注销路由,也是302-ing非访客到根页面。

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

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