The Roots theme for WordPress is awesome, and so is WPEngine. When using the two together you’ll need to configure nginx rewrite rules to get the Rewrites (clean URLs for static theme assets) feature working properly.

WPEngine doesn’t give you access to an nginx.conf file, so you’ll need to use WPEngine’s Redirect Rules feature to configure these redirects. Luckily, it’s very simple to do.

Manage Rewrite Rules on WPEngine

  1. Login in to your WPEngine account at my.wpengine.com
  2. Browse to the Redirect Rules screen
  3. Add the following redirect rules

Rewrite for /assets/

  • Redirect Name: Assets
  • Domain: All Domains
  • Source: ^/assets/(img|js|css|fonts)/(.*)$
  • Destination: /wp-content/themes/roots/assets/$1/$2

Rewrite for /plugins/

  • Redirect Name: Assets
  • Domain: All Domains
  • Source: ^/plugins/(.*)$
  • Destination: /wp-content/plugins/$1

As a side note, this can be used in general to setup custom nginx redirects and rewrites, similar to location and try_files, on WPEngine.