0

how do I do a rewrite in nginx from

http://www.example.com (with or without trailing slash)

to add index.php at the end?

For the example above the result should be

http://www.example.com/index.php

No special rules, just one domain to change.This should be simple but I can't seem to figure it out :-(

Thanks!

1 Answer 1

1

Assuming you mean you want the user's address bar to change, you just need one extra location in your server block:

location = / {
  return 301 http://www.example.com/index.php;
}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.