WordPress.org

Forums

WP REST API (WP API)
[resolved] URL rewrite from /wp-json.php to /api (5 posts)

  1. markzero
    Member
    Posted 1 year ago #

    Is it possible to do rewriting from site.com/wp-json.php/ to site.com/api/?

    I'm using nginx and have such rewrite rule:
    rewrite ^/api/(.*) /wp-json.php/$1 break;

    But it doesn't work, but other rewrites do work using identical logic.
    Any help?

    https://wordpress.org/plugins/json-rest-api/

  2. B
    Member
    Posted 1 year ago #

    Try no slash after wp-json.php.

    rewrite ^/api/(.*) /wp-json.php$1 break;

  3. Ryan McCue
    Member
    Plugin Author

    Posted 1 year ago #

    At the moment, you have to edit the main file yourself. I've filed an issue for this. Thanks!

  4. nicshel2
    Member
    Posted 10 months ago #

    Hi Ryan,

    I'm trying to do the same myself.

    When you said edit the main file, which file /files do you mean ?

    I've tried updating :
    add_rewrite_rule( '^wp-json/?$','index.php?json_route=/','top' );
    add_rewrite_rule( '^wp-json(.*)?','index.php?json_route=$matches[1]','top' );

    But it didn't work, it still expects wp-json.

    Thanks,

    Lisa

  5. idafae
    Member
    Posted 7 months ago #

    I am very, very new to WP.org. I have some experience with WP.com
    My self-hosted website is at http://www.ifcullen.com and I am trying to sync up my Windows Live Writer with my website. It's so much easier to format my posts with images, etc. It's asking for the "API url" and I haven't a clue where to find that?
    Please help. will post this in a better category next.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic