Thread: nginx rewrite
View Single Post
  #2  
Old 31st July 2012, 18:25
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
Default

You can try nested locations for each folder, e.g. like this:

Code:
location / {
                try_files $uri $uri/ /index.php?$args;

               # Add trailing slash to */wp-admin requests.
               rewrite /wp-admin$ $scheme://$host$uri/ permanent;

               location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                    expires max;
                    log_not_found off;
               }
               # Deny public access to wp-config.php
               location ~* wp-config.php { 
                    deny all; 
               }

}
Then try the same for a subfolder:

Code:
location /subfolder {
                try_files $uri $uri/ /index.php?$args;

               # Add trailing slash to */wp-admin requests.
               rewrite /wp-admin$ $scheme://$host$uri/ permanent;

               location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                    expires max;
                    log_not_found off;
               }
               # Deny public access to wp-config.php
               location ~* wp-config.php { 
                    deny all; 
               }

}
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote