Title: Please include nginx rewrite rules for apache users
Last modified: August 20, 2016

---

# Please include nginx rewrite rules for apache users

 *  [Mayhem30](https://wordpress.org/support/users/mayhem30/)
 * (@mayhem30)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/please-include-nginx-rewrite-rules-for-apache-users/)
 * Could you please include an option to display the nginx rewrite rules in the 
   install tab (or add a hidden ?page=w3tc_install_nginx) page for us Apache users
   that would rather have our nginx ‘frontend’ handle the rewrites?
 * Thank you.
 * [http://wordpress.org/extend/plugins/w3-total-cache/](http://wordpress.org/extend/plugins/w3-total-cache/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Mayhem30](https://wordpress.org/support/users/mayhem30/)
 * (@mayhem30)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/please-include-nginx-rewrite-rules-for-apache-users/#post-3452325)
 * After doing some testing, I found some interesting results.
 * If you let nginx handle all incoming connections and just proxypass php files
   to apache, pingdom.com was showing load times of 1.8 -> 2.2 ms – which is really
   good.
 * However, I decided to add in the following config to see what would happen
 *     ```
       # Set a variable to work around the lack of nested conditionals
                set $cache_uri $request_uri;
   
                # POST requests and urls with a query string should always go to PHP
                if ($request_method = POST) {
                   set $cache_uri 'no cache';
                }
                if ($query_string != "") {
                   set $cache_uri 'no cache';
                }
   
                location / {
                   try_files /wp-content/cache/page_enhanced/$host/$cache_uri/_index.html $uri @backend;
                }
       ```
   
 * [@backend](https://wordpress.org/support/users/backend/) is my block that handles
   passing php requests off to apache for processing.
 * This is what pingdom.com shows now : [http://i49.tinypic.com/2ngzif4.png](http://i49.tinypic.com/2ngzif4.png)
 * The difference is night and day! The blog pages load instantly – no more ~1.5
   sec pause before the content displays.
 * So if your running a similar setup (nginx up front, apache backend) you should
   really mess around with the ‘try_files” directive and get it to check for the
   static resource first.
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/please-include-nginx-rewrite-rules-for-apache-users/#post-3452339)
 * Nice example. Thanks for sharing the code.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Please include nginx rewrite rules for apache users’ is closed to new
replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [apache](https://wordpress.org/support/topic-tag/apache/)
 * [nginx](https://wordpress.org/support/topic-tag/nginx/)

 * 2 replies
 * 2 participants
 * Last reply from: [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/please-include-nginx-rewrite-rules-for-apache-users/#post-3452339)
 * Status: not resolved