简体   繁体   中英

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)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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