Wordpress更换目录后链接跳转Nginx规则

#1010

追光
管理员

然后最近对wordpress核心站点的文章和目录做了链接调整的nginx规则

# 所有 vfx-software 目录跳转到 download/vfx-university-footage/vfx-software/
location ~ ^/vfx-software/(.*)$ {
    return 301 https://www.newvfx.com/download/vfx-university-footage/vfx-software/$1;
}

# vfx-university-footage 内部素材跳转到 download 目录
location ~ ^/vfx-university-footage/(.*)$ {
    return 301 https://www.newvfx.com/download/vfx-university-footage/$1;
}

# audio-footage 跳转
location ~ ^/audio-footage/?$ {
    return 301 https://www.newvfx.com/download/audio-footage;
}

location ~* /wp-admin/admin-ajax\.php$ {
    allow all;
    include fastcgi_params;
    fastcgi_pass unix:/tmp/php-cgi-82.sock;  # 按你的 php 配置改
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_intercept_errors off;
    add_header Access-Control-Allow-Origin "https://www.newvfx.com";
    add_header Access-Control-Allow-Credentials "true";
}