Looking for canonical issue in my site is I can get the right canonical url like
http://www.example.com/quotes/123/this_is_it
but if someone changes the 123
to 158
it still shows the content of 123. I think it get the content with the slug i.e. this_is_it
.
What I want is to get a 404 or a redirect to actual page if someone tries to change any one of either {id} or {slug}
I got my route as
Route::get('/quotes/{id}/{slug}','QuotesController@quoteShow');
and controller as
public function quoteShow($id,$slug)
{
$quotes= DB::table('quotes')->where('id', $id)->get();
foreach ($quotes as $data) {
$id= $data->id;
$author_id= $data->author_id;
$quote= $data->quote;
$status= $data->status;
}
$author= DB::table('authors_list')->where('id', $author_id)->get();
return view('pages.quote', ['author' => $author, 'quotes'=>$quotes]);
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SxSEV1
via IFTTT
Aucun commentaire:
Enregistrer un commentaire