Currently I'm using
location /login {
rewrite ^/login/$ /login.php last;
rewrite ^/login$ /login.php last;
}
to rewrite www.example.com/login and www.example.com/login/. I was wondering if this was also possible in one statement. I tried rewrite ^/login(/)$ /login.php last;
but it didn't work.
Also I noticed since I started using rewrites that some of my css paths are broken because I used a relative paths. I will convert all of them to absolute paths but asked myself if there a more implications when using rewrites that I would need to be aware of.
EDIT:
This is how I handle the .php
location ~ \.php$ {
if (!-f $request_filename) {
return 404;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
try_files $uri $uri/ /index.php;
}
In RegEx, a question mark makes the preceding token optional.