- there is a nginx with
php-fpminstalled. there is a subdirectory/shopwithmain.phpinside. main.phpworks in a following way: if request isexample.com/shop/product/123- it's requestingexample.com/shop/main.php?route=/product/123/(this works with nginx+apache)
here is the .htaccess content
RewriteCond %{REQUEST_URI} !\.(ico|jpg|png|img)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) main.php?route=$1
What I've tried to do:
location ^~ /shop/product {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
try_files $uri $uri/ /shop/main.php?route=$1 ;
}
-- this is not working, it is returning a 404
location /shop {
try_files $uri $uri/ /shop/main.php?route=$uri;
}
this returns incorrect page because $uri is /shop/product/123
What I'm trying to achieve is to strip 'shop' word from $uri.