Unsupported: Clean URL rewrites for WordPress assets
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.editorconfig
.gitignore
LICENSE.md
README.md
composer.json
roots-rewrites.php

README.md

Roots Rewrites

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/

Requirements

  • 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

Installation

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;
}

Support

This plugin is no longer supported by Roots and is unlikely to be updated.

Troubleshooting

Visit your site's permalinks page to flush rewrite rules; and open .htaccess to check that the rules are being written correctly.

Community Support

You may visit Roots Discourse and search for answers or ask questions.

Changelog

1.0.1: August 14th, 2014

  • Supports non-Roots based themes, de/activation hooks added to flush rewrites

1.0.0: November 5th, 2013

License

MIT License