我希望人们在
中输入或打开一些网址https://someweb.com/like-{numberpage}.html
将重定向到
https://someweb.com/like/id
我在配置中写了这样的东西,但它不起作用。
server {
listen 80;
server_name forum.someweb.com *.forum.someweb.com ;
access_log /var/log/nginx/forum.someweb.access.log main;
error_log /var/log/nginx/forum.someweb.error.log ;
root /var/www/vhosts/someweb.com/public_html/forum ;
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite /urladmin$ $scheme://$host$uri/ permanent;
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
location / {
try_files $uri $uri/ /index.php?$args;
rewrite /category-([0-9]+)-([0-9]+).html$ /category.php?id=$1&page=$2 last;
rewrite /index-([0-9]+).html$ /index.php?page=$1 last;
rewrite /like/([0-9]+).html$ /like.php?id=$1 last;
rewrite ^/(.*).html$ /$1.php last;
}
if ($http_host = "forum.someweb.com") {
rewrite ^ https://forum.someweb.com$request_uri permanent;
}
location ~ .*\.php$ {
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php-fpm.sock;
include fastcgi_params;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME /var/www/vhosts/someweb.com/public_html/forum$fastcgi_script_name;
try_files $uri =404;
}
}
我也重启了我的nginx服务器,但仍然......它没有重定向。