简体   繁体   English

如何从url隐藏/删除wp-content / uploads?

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

I am very much new to WordPress. 我对WordPress非常陌生。 I am trying to remove/hide 'wp-content/uploads/2017/02' I have tried below but it is giving 'Page Not Found'. 我正在尝试删除/隐藏我在下面尝试过的'wp-content / uploads / 2017/02',但它给出的是“找不到页面”。 I want to know if is there any other way to hide 'wp-content/uploads/2017/02'? 我想知道是否还有其他方法可以隐藏“ 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'. 但我无法删除“ 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. 204是“无内容”响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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