Answer the question
In order to leave comments, you need to log in
How to add slash at the end of url in Laravel site using nginx?
There is a site on Laravel. The site has a blog /blog. The site has categories, /blog/namecategory. If you choose to filter all categories, it will be /blog/all.
I need to configure NGINX to always remove the slash for /blog/all and always add a slash to the end of /blog/namecategory to be /blog/namecategory/
How can I do this?
I tried to do like this:
location /blog {
rewrite ^(.*[^/])$ $1/ permanent;
}
if ($request_uri !~ "(\.html|\/)$") { return 301 "$request_uri/"; }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question