问题
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