This is a helper plug in that you install and activate 1 time. It Strips the year and month from Media attachments. This plug in works best with the https://www.screenfeed.fr/plugin-wp/upload-url-path-enabler/ which does work in 4.9.6.
Proper set up of the upload-url-path plug in.
Once activated you can deactivate it and remove it if you wish. What it does is fix Media Attachment URL meta tags in the database.
This version is if you use a single folder /wp-content/uploads/
DO NOT USE THIS IF YOU USE YEAR AND MONTH FOLDERS ( WORD PRESS DEFAULTS )