Roots Rewrites enables clean URL rewrites for your WordPress plugins and theme assets folder.
/wp-content/themes/themename/assets/css/ to /assets/css/
/wp-content/themes/themename/assets/js/ to /assets/js/
/wp-content/themes/themename/assets/img/ to /assets/img/
/wp-content/plugins/ to /plugins/
Note: If you use Composer to manage WordPress then you don't need to use this plugin, as your paths would look like:
/app/themes/themename/assets/css/
/app/themes/themename/assets/js/
/app/themes/themename/assets/img/
/app/plugins/
-
Apache with mod_rewrite enabled through .htaccess; Nginx (see Installation for configuration); or any other server that allows you to control its rewrite rules.
-
Roots Theme (6.5.1+) is recommended for compatibility, but is not a requirement since 1.0.1
Apache will flush rewrite rules on activation and deactivation.
If you're using Nginx, you'll need to add the Roots rewrites to your server config before the PHP block (location ~ \.php$
):
location ~ ^/assets/(img|js|css|fonts)/(.*)$ {
try_files $uri $uri/ /wp-content/themes/roots/assets/$1/$2;
}
location ~ ^/plugins/(.*)$ {
try_files $uri $uri/ /wp-content/plugins/$1;
}
This plugin is no longer supported by Roots and is unlikely to be updated.
Visit your site's permalinks page to flush rewrite rules; and open .htaccess to check that the rules are being written correctly.
You may visit Roots Discourse and search for answers or ask questions.
- Supports non-Roots based themes, de/activation hooks added to flush rewrites
- Removed from Roots Theme, moved to plugin
MIT License