Reputation: 133
Hello i'm using laravel 5 for my project.
i have routes like :
news/some-news-title/galery?page=2#photo/
it works great for my paginating galleries. But i saw that when i add extra parameter end of to url , it still works.
example :
news/some-news-title/galery?page=2/amp
news/some-news-title/galery?page=2/asdasd
normally it should not work. But it shows same gallery page.
i tried some codes , but it did not work for me :
Route::any('news/{any}/{any?}/amp', function(){
return 'error';
});
Route::any('news/{any}/{any}/{any}', function(){
return 'error';
});
when tried these codes , it still opens same page.
How can i block or redirect this parameters to 404 page ?
Thanks !
Upvotes: 1
Views: 653
Reputation: 788
it works great for my paginating galleries. But i saw that when i add extra parameter end of to url , it still works.
It seems that it is the right behaviour .
Lets have a look at your URL
It may be something like http://example.com/news/some-news-title/galery?page=2#photo/anythingelse
I have checked it at http://www.freeformatter.com and it says :
Now Your are concerned about last part of url(Hash).
According to wikipedia :
The fragment identifier introduced by a hash mark # is the optional last part of a URL for a document. It is typically used to identify a portion of that document.
In simple word you can't filter the Hash Part because it belongs to current document and treated as single and last portion of URL.
Upvotes: 1