I've been using Appserv for a while and moved to Nginx for now. When I was running my website under Appache I had this configuration in the .htaccess file in order to link the subdomain to the subdirectory.
#Redirect API subdomain to API folder
RewriteCond %{HTTP_HOST} ^api\.domain\.com$
RewriteCond %{REQUEST_URI} !^/request/
RewriteRule (.*) /request/$1
I tried to add this configuration to the nginx.conf file to do the same:
location ^~ /request/ {
rewrite ^/request/(.*) http://api.example.com/$1 permanent;
}
It seems like it doesn't work since I'm being redirected to the main domain URL. How do I manage to do that in Nginx ?