Dear All,
We are into a migration project form Apache -> Nginx for a PHP site.
Our project folder consists of
project
|-- www
|-- lib
The www as expected contains all php/html files/directories and lib contains libraries.
The 'document root' within Apache is set to 'project' folder with a rewrite rule:
RewriteEngine on
RewriteRule ^/(.*)$ /project/www/$1
This is so that people can't access /project/lib via the web. This works perfectly fine within Apache.
Within NGINX, to replicate the above, we have a location block with rewrite:
location / {
root /project
rewrite ^/(.*)$ /www/$1 break;
}
This works but not when the page is reloaded using PHP_SELF.
Within certain pages, we have PHP_SELF that reloads the page when a user does some action on that page. The reloading re-introduces '/www/' as below:
1. URL when First time page is accessed: http://x.com/DL/control_panel/x.php (works fine)
2. URL when Page is reloaded via PHP_SELF: http://x.com/www/DL/control_panel/x.php (Does'nt Work)
Access log for 1: "GET /DL/control_panel/x.php"
Access log for 2: "GET /www/DL/control_panel/.php"
How can I rectify the above? basically for 2 above, it should NOT have /www in the front I suppose.
Any help would be greatly appreciated.
Thanks.