我正在尝试匹配和替换特定文件夹中的资产URL,而不影响.htaccess文件中的其他URL。我的问题是.htaccess方面,只是在努力让核心匹配正确的URL。
给定这三个URL:
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
我只想匹配最后一个(包含themes
),因此之后的所有内容/fonts/
RewriteRule /?fonts/(.*)$ wp-content/themes/ng-health/app/fonts/$1 [NC,L]
http:\/\/.+(?!wp-includes|plugins)\/fonts\/(.*)
(匹配所有内容:http : //regexr.com/39vka)
你快到了
正则表达式可以是
http:\/\/.+(?<!wp-includes|plugins)\/fonts\/.*
范例:http://regex101.com/r/tE0dL9/1
进行更改
(?<!wp-includes|plugins)
负面展望。Assertst是/fonts/
不是由prescededwp-includes
或plugins
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句