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

我的未来我决定 提交于 2019-12-25 07:48:15

问题


I have an application using the A2 host provider, and inside the public directory its my laravel folder (www.website.com/app)

And in my server preferences I am redirecting the root "/" to "/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...)

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.


回答1:


I was having the same problem trying to reach a route on the provided 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.



来源:https://stackoverflow.com/questions/29083400/route-on-laravel-keeps-redirecting-301-to-root-of-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!