定制 24hr/wordpress-redirect-options-plugins 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

24hr/wordpress-redirect-options-plugins

Composer 安装命令:

composer require 24hr/wordpress-redirect-options-plugins

包简介

A plugin for managing redirects for 24hr projects

README 文档

README

Wordpress plugin

The Wordpress plugin can be downloaded here. It will just create a new options page with some ACF fields and add new API endpoint. It will also register the options to our synk plugin.

Wordpress API endpoint: /json/api/general/redirects

NPM module

There is a NPM module that includes a helper function to match urls. This helper supports wildcard paths.

By passing the redirect options from Wordpress along with the request path it will return useful data. If no match it will return null.

Returned object (if match) contains the URL to redirect to, code to set as status code and headers that are recommended to use.

Koa example:

const { redirectMatcher } = require('@24hr/redirect-matcher');
app.use(async (ctx, next) => {
    const redirectOptions = await getRedirectOptionsSomehow(); // <-- This part is your responsibility

    const redirectData = redirectMatcher(redirectOptions, ctx.path);

    if (redirectData) {
        ctx.status = redirectData.code;
        ctx.set(redirectData.headers);
        ctx.redirect(redirectData.url);
    } else {
        await next();
    }
});

统计信息

  • 总下载量: 188
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-10-20