Nginx How to rewrite the static form of the URL as dynamic?

Source: Internet
Author: User
I use lumen to make the API excuse, the URL is static, similar to this:
Https://www.foo.com/api/v1/ar ...
The ID here is the required parameter.
But when I call this interface, the pass-through parameter uses this URL format:
Https://www.foo.com/api/v1/ar ...

Can I change the URL format to support directly in Laravel or lumen? The form of a query?

Or in the Nginx rewrite method rewrite to achieve, specifically how to re?
Thank you!!

Reply content:

I use lumen to make the API excuse, the URL is static, similar to this:
Https://www.foo.com/api/v1/ar ...
The ID here is the required parameter.
But when I call this interface, the pass-through parameter uses this URL format:
Https://www.foo.com/api/v1/ar ...

Can I change the URL format to support directly in Laravel or lumen? The form of a query?

Or in the Nginx rewrite method rewrite to achieve, specifically how to re?
Thank you!!

This does not require a URL rewrite route

Route::any('api/v1/article', function(Request $request){    $id = $request->input('id');    if (empty($id)) return 'parameter "id" invalid. ';    return redirect('api/v1/article/'.$id);})Route::any('api/v1/article/{id}', 'ArticleController@index');

Thank you for your invitation.

https://laravel-china.org/topics/688

The routing is set up a bit.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.