It is impossible to make a revwrite from http://blabla.mysite.ru/ to http://mysite.ru/index.php/page/blabla ... I did it as in the config below, but it seems to be trying to open file /www/mysite/index.php/page/blabla , which, of course, does not exist.

I make a 302 redirect, but it changes the url in the browser, which is not necessary. How to solve a problem?

 location / { try_files $uri /index.php?$args; set $uid "www"; if ($host ~ "^([a-z0-9\-]+)\.mysite\.ru$") { set $uid $1; } if ($uid !~ "^(www)$") { rewrite ^(.*)$ /index.php/page/$uid last; } } 
  • why, rewrite is quite currently being discussed here - thunder
  • Do you really need a revright, not a proxy? - dlarchikov

1 answer 1

you probably need to redirect the request to /index.php , passing the rest of the path as request parameters. i.e., on this line:

 rewrite ^(.*)$ /index.php/page/$uid last; 

should / after /index.php be replaced with ? :

 rewrite ^(.*)$ /index.php?page/$uid last;