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;
}
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.