How to redirect to a route in laravel 5 by using href tag if I'm not using blade or any template?

Jasmel Pc picture Jasmel Pc · Dec 4, 2015 · Viewed 136.7k times · Source
Route::get('/page','UserController@view page'); 

is my route.

I have a list with href tag and I want to redirect to this route.

<ul>
    <li><a href="">how it works</a></li>
</ul>

I am not using blade or any other templates.

Answer

chanafdo picture chanafdo · Dec 4, 2015

In you app config file change the url to localhost/example/public

Then when you want to link to something

<a href="{{ url('page') }}">Some Text</a>

without blade

<a href="<?php echo url('page') ?>">Some Text</a>