FD_F Posted July 11, 2011 Share Posted July 11, 2011 Hi, i have many sub domains i need to rewrite for example: http://subx.domain.com/i30/index.html will rewrite to: /home/domain/live.domain.com/subx/i30/index.html so i did rule: if ( $host ~ "subx.domain.com" ) { rewrite ^(.*) http://live.domain.com/subx/$uri last; } but i don't want make every time different rule and i need to create one will take care all the sub domains with the same course any ideas ? thanks! Link to comment https://forums.phpfreaks.com/topic/241652-help-with-nginx-rule/ Share on other sites More sharing options...
FD_F Posted July 12, 2011 Author Share Posted July 12, 2011 problem solved set $subdomain ""; set $subdomain_root ""; if ($host ~* "^(.+)\.domain\.com$") { set $subdomain $1; set $subdomain_root "/$subdomain"; rewrite ^(.*)$ $subdomain_root$1; break; } Link to comment https://forums.phpfreaks.com/topic/241652-help-with-nginx-rule/#findComment-1241743 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.