I have a site and i wish to replace a part of URL, https://example.com/[THISPART]/file.ext.
Example URLs that will be requested on site:
https://example.com/example-page/sw.js
https://example.com/example-page/image.jpg
https://example.com/some-other-page/sw.js
https://example.com/some-other-page/file.pdf
https://example.com/page-with-attitude-4/sw.js
https://example.com/page-with-attitude-4/info.txt
How I want to rewrite them:
https://example.com/content/example-page/sw.js
https://example.com/example-page/image.jpg
https://example.com/content/some-other-page/sw.js
https://example.com/some-other-page/file.pdf
https://example.com/content/page-with-attitude-4/sw.js
https://example.com/page-with-attitude-4/info.txt
In other words, if only sw.js is requested, then rewrite to other URL. What I have used so far in my htaccess is this:
RewriteRule ^(.*)\/sw.js$ content/$1/sw.js [L]
I've been using http://htaccess.mwl.be/ as a tester and test shows alright, but when I use it on site, it doesn't work. Any help?