Created
March 13, 2013 07:05
-
-
Save markstewie/5149902 to your computer and use it in GitHub Desktop.
A rewrite of the roots_add_rewrites function for the Roots Wordpress framework so that rewrites work when Wordpress is installed in a subdirectory.
This function is found in roots/lib/htaccess.php. Once saved, go to the Settings->Permalinks page and things should work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function roots_add_rewrites($content) { | |
global $wp_rewrite; | |
$base = str_replace('/', '', WP_BASE); | |
if($base != '') $base = $base.'/'; | |
$roots_new_non_wp_rules = array( | |
$base .'assets/css/(.*)' => $base . THEME_PATH . '/assets/css/$1', | |
$base .'assets/js/(.*)' => $base . THEME_PATH . '/assets/js/$1', | |
$base .'assets/img/(.*)' => $base . THEME_PATH . '/assets/img/$1', | |
$base .'plugins/(.*)' => $base . RELATIVE_PLUGIN_PATH . '/$1' | |
); | |
$wp_rewrite->non_wp_rules = array_merge($wp_rewrite->non_wp_rules, $roots_new_non_wp_rules); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment