I have a URL which contains subfolders in the path and may or may not contain .html.
I want to match if the url contains "/p/" in the path AND there is no .html at the end. If these conditions are met, I want to append with .html
I have tried with if statements and location but no luck with any of those.
This is what I have tried with no luck:
if ($uri ~ ^(.*)/p/(.*)$){
rewrite ^(.+)/$ $1.html permanent;
}
if ($uri ~ ^(.*)/p/(.*[^.html])$){
rewrite ^(.+)/$ $1.html permanent;
}
location ~ ^(.*)/p/(.*[^.html])$ {
rewrite ^(.+)/$ $1.html permanent;
}
Aucun commentaire:
Enregistrer un commentaire