0
votes


I conisder moving to Nginx but I want you to ask if is possible to rewrite urls into that schema, and if you could help me a bit:

1

1 Answers

0
votes

Yes, it is possible to rewrite URLs with Nginx.

  • Your first example can be handled easily by wrapping the rewrite with a block which checks if a file (home.php in your example) exists; if it doesn't, then it tries the redirect into the profile.php request. (See the try_files syntax for this.)

  • Your second example is just as simple:

    Rewrite ^/questions/(\d+) /questions.php?quid=$1

(Because the matching expression is not anchored at the end, it should accept any string after the digits, but I haven't checked that so I'd recommend you test it.)