简体   繁体   中英

How to hide/remove wp-content/uploads from url?

I am very much new to WordPress. I am trying to remove/hide 'wp-content/uploads/2017/02' I have tried below but it is giving 'Page Not Found'. I want to know if is there any other way to hide 'wp-content/uploads/2017/02'?

RewriteRule ^wp-content/uploads/(.+)$ http://172.16.60.51/project-root/$1 [R=301,L]

UPDATE: I am able to achieve following with the code that follows.

RewriteRule ^my_uploads/(.+) /project-root/wp-content/uploads/$1 [L,QSA]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^wp-content/uploads/(.+) /project-root/index.php?wph-throw-404 [L]

But I am not able to remove '2017/02'.

To restrict the access you can use below that might help you to solve your issue.

RedirectMatch 204 ^/uploads/$
RedirectMatch 204 ^/uploads/dir/$

204 is the No Content response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM