Extensions. .php
hid.
When requesting the site.com/username
type site.com/username
nginx site.com/username
to first check if there is a file like username.php
, and if there is no such file, then substitute it with a link like site.com/profile.php?user=username
Well and so on the course I checked the presence of the file, and if there is no file, then I substituted the variable.
On Apache, it should look something like this:
RewriteEngine on RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^\.]+)$ $1.php [NC] RewriteCond %{REQUEST_FILENAME} >"" RewriteRule ^([^\.]+)$ profile.php?user=$1 [L]
How to do this for nginx ?