skip to Main Content

I have url generated from pagination:

$next = $articles->nextPageUrl();

However this new url always leads to redirect. For SEO reasons i need to put there final url (generated after all redirects). How can i achieve this properly in Laravel?

E.g. Url generated by nextPageUrl() is /page/83?page=4, however it redirects to /blog?page=4. I should somehow get /blog?page=4.

How can i achieve this properly in Laravel?

3

Answers


  1. In this method you need to declare input type Page

    Example :
    As You shown in My Project i have given filename

    Just follow this Steps
    In your Controller

     $namefile = $request->get('filename');
     return view('BladeFilename')->with('filename', $namefile);
    

    Just change $request get to whatever you want

    Login or Signup to reply.
  2. One way to do this would be to manually trace the redirect (5.4 version syntax):

    // Call the given Closure / class@method and inject its dependencies.
    $redirect = App::call('AppHttpControllersSomeController@someMethodWithRedirect');
    
    /** @var RedirectResponse $redirect */
    $redirect->getTargetUrl();
    

    This approach wouldn’t fit if the called functions aren’t pure (does any DB persisting, etc).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search