location /product/ {
try_files $uri $uri/ /product.php?$args;
}
# В PHP разберите slug, получите id и отдайте страницу.
RewriteEngine On
# Пример: /product/123-slug/ -> /product.php?id=123
RewriteRule ^product/([0-9]+)-?(.+)?/?$ /product.php?id=$1 [L,QSA]
# Канонизация: www -> без www + https (в один прыжок)
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.ru$ [NC]
RewriteRule ^(.*)$ https://example.ru/$1 [L,R=301]