Support » Plugin: WP REST API (WP API) » URL rewrite from /wp-json.php to /api

  • Resolved Marko Jakic

    (@markzero)


    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/

Viewing 4 replies - 1 through 4 (of 4 total)
  • B

    (@bh8489)

    Try no slash after wp-json.php.

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

    Plugin Author Ryan McCue

    (@rmccue)

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

    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

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘URL rewrite from /wp-json.php to /api’ is closed to new replies.