Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 2 years ago.
0

Have you tried something like this...

http://forumsarchive.laravel.io/viewtopic.php?id=15446

Last updated 2 years ago.
0

Hello Thank you for the reply. It didn't work with the link you provided me but it pointed me to the right direction. Here is my final code.


$url = URL::route('route_name', array('id'=>$id, '#hash_tag'));

Redirect::to($url)


Thank you.

Last updated 2 years ago.
0

A better way would be to append #hash after URL::route(...) so you won't get a question mark in the url.

With array:

$url = URL::route('welcome', ['#hash']);
return Redirect::to($url); // domain.com/welcome?#hash

Without (appended):

$url = URL::route('welcome') . '#hash';
return Redirect::to($url); // domain.com/welcome#hash
Last updated 2 years ago.
0

Marwelln said:

A better way would be to append #hash after URL::route(...) so you won't get a question mark in the url.

With array:

$url = URL::route('welcome', ['#hash']);
return Redirect::to($url); // domain.com/welcome?#hash

Without (appended):

$url = URL::route('welcome') . '#hash';
return Redirect::to($url); // domain.com/welcome#hash

This is definitely returns a clean result. But we need to write more code. Is there any way to use Redirect::route and get rid of the question mark?

Last updated 2 years ago.
0

How about this:

return redirect(route('home') . '#foo');
0

Sign in to participate in this thread!

Eventy

Your banner here too?

monaye monaye Joined 5 Jan 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.