Reputation: 161
I am trying to match and replace asset URLs from a specific folder, without affecting other URLs in my .htaccess file. I have the .htaccess side of things down, am just struggling hardcore to match the correct URLs.
Given these three URLs:
http://nia.wp/wp-includes/fonts/tinymce.ttf
http://nia.wp/wp-content/plugins/fonts/Bootstrap-Shortcodes-for-WordPress.ttf
http://nia.wp/wp-content/themes/fonts/Bootstrap-Shortcodes-for-WordPress.ttf
I only want to match the last one (containing themes
), and for that matter everything after /fonts/
RewriteRule /?fonts/(.*)$ wp-content/themes/ng-health/app/fonts/$1 [NC,L]
http:\/\/.+(?!wp-includes|plugins)\/fonts\/(.*)
(matches everything: http://regexr.com/39vka)
Upvotes: 1
Views: 1105
Reputation: 415
Try this also.
http:\/\/(?:(?!themes).)*themes\/fonts\/.*
SEE DEMO : http://regex101.com/r/fW1iC9/1
Upvotes: 0
Reputation: 26667
You were almost there.
Regex can be
http:\/\/.+(?<!wp-includes|plugins)\/fonts\/.*
Example : http://regex101.com/r/tE0dL9/1
Change made
(?<!wp-includes|plugins)
negative look behind. Assertst that /fonts/
is not presceded by wp-includes
or plugins
Upvotes: 1