我正在try 将Domain.com/Review/(Dynamic).php重写为/Review/index.php?slug=$1
这是我的服务器模块,它不能工作.当我try 重写动态URL时,总是给我一个404.
location / {
index index.php index.html index.htm;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location /reviews/ {
rewrite ^/reviews/(.*).php$ /reviews/index.php?slug=$1 last;
}
error_page 404 /404.php;
当我从重写行中删除.php并try /reviews/namehere
时,它工作得很好.
如有任何帮助,我们不胜感激.