0

I am having a lot of difficulty configuring nginx pretty URLs with PHP. I am trying to rewrite /verify/codehere (code example: dsifoj24234j) to verify.php?key=codehere

Here is my current configuration:

location ^/verify/(.*)$ {
    /verify.php?key=$1 last;
}

location / {
    try_files $uri $uri/ /index.php;
}

.. It's not working, which brings me here. How can I fix it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user2350858
  • 681
  • 2
  • 10
  • 16

1 Answers1

1
location ^/verify/(.*)$ {
    try_files /verify.php?key=$1 =404;
}

# or

rewrite ^/verify/(.*)$ /verify.php?key=$1 last;
Mohammad AbuShady
  • 40,884
  • 11
  • 78
  • 89