1

I've switched over from Apache to Nginx. A very smooth and trouble free process, until I had to sort out a .htaccess file I have, and now I am stumped.

I understand that Nginx does this differently and that this needs to be done in the config file (within a location /{code here} entry) using regex and the built-in rewrite function but I cannot figure it out!

I need to convert a URL request from this:

http://example.com/datasources/apis/v1/login.php

To:

http://example.com/datasources/apis/API_controller.php/v1/login.php

The PHP script will vary and there will sometimes be some variables in the URL (as in a GET request)

A steer in the right direction would be great.

1 Answer 1

2
location ^~ /datasources/apis/v1/ {
    rewrite ^/datasources/apis/v1/(.*) /datasources/apis/API_controller.php/v1/$1;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.