admin管理员组文章数量:1125050
I can not access my uploaded .txt in Wordpress, it gives a 403 access denied error. I can access .png files however, why not .txt files?
I uploaded my file here:
And got the URL here (I click copy, go in incognito mode, paste it and get the 403 error):
I can not access my uploaded .txt in Wordpress, it gives a 403 access denied error. I can access .png files however, why not .txt files?
I uploaded my file here:
And got the URL here (I click copy, go in incognito mode, paste it and get the 403 error):
Share Improve this question edited Feb 12, 2024 at 15:38 Tom J Nowell♦ 60.7k7 gold badges77 silver badges147 bronze badges asked Feb 9, 2024 at 18:55 NoKeyNoKey 101 4- if you visit a file directly it's not WordPress serving it but the host itself aka Apache/Nginx. It's very likely this is your hosts security software or a HTAccess rule and nothing to do with WordPress – Tom J Nowell ♦ Commented Feb 9, 2024 at 19:21
- @TomJNowell No it's related to Wordpress, I bought a domain just through wordpress and they host everything. What is the problem by just showing the .txt? How can I make sure other people can just download the .txt? It looks so hard for such a simple task. I don't know anything about HTAccess rules, Apache/Nginx. Why is uploading/downloading a simple .txt so hard in Wordpress? – NoKey Commented Feb 9, 2024 at 22:03
- 1 Ah do you mean wordpress.com? This stack is for WordPress the open source PHP software, not the 3rd party commercial hosting service WordPress.com ran by Automattic. WordPress is just the PHP application that runs on the host, WordPress itself won't be serving those text files, your host will be ( in your specific case it seems both the software and the host have almost the same name, and it'll be an Nginx server from what I understand of WordPress.com's services ). – Tom J Nowell ♦ Commented Feb 12, 2024 at 15:23
- This will help avoid confusion in the future: wordpress.com/support/com-vs-org and wordpress.org/documentation/article/…, when you see people talking about code they're almost always talking about .org, not .com. WordPress.com works a little differently and can have quirks, restrictions, as well as features you wouldn't normally find elsewhere without installing a plugin ( usually via Jetpack ) – Tom J Nowell ♦ Commented Feb 12, 2024 at 15:24
1 Answer
Reset to default 0WordPress isn't doing this, those files are served by the server underneath WordPress, aka Nginx/Apache/etc. This is because there's a cost to loading WordPress and you don't want to pay that cost for assets such as JPEG's or other files in the uploads folder, it's much faster to let Apache/Nginx do it as that's something they've been optimised for.
why not .txt files?
Because you're a WordPress.com customer:
WP.com has configured their servers not to serve plaintext files as a security measure.
Is WordPress.com not WordPress?
No, WP.com is a 3rd party host that hosts WordPress sites. Its main differentiator is that it has access to the trademarks and is ran by the founder, but the software it runs isn't quite the same as what everybody else is running.
WordPress.com has a lot of additional restrictions, features, and quirks intended to make it more secure and scale better. Partially because it used to be one gigantic multisite installation. One of these differences will be stopping displaying arbitrary text files which could be used for malicious purposes.
Most WordPress sites do not run on WordPress.com
Resolving This
You'll need to speak with their support to resolve this, though there's a high chance they'll say that it is not possible. Moving to an alternate host is also an option.
E.g. I was able to upload and serve a plaintext file on my host (a VPS):
https://tomjn.com/wp-content/uploads/2024/02/wordpress-text-files.txt
The edge case
For completeness sake should someone else be reading this, the one scenario where WordPress does serve these files is ms-files.php
. If your direct URL to the text file references ms-files.php
then WordPress is responsible, however this requires that you have multisite setup, and have configured WordPress to use this file.
In the case of a WordPress.com site, this is extremely unlikely, and virtually impossible on anything newer than 10 years old. If you do not see ms-files.php
in the URL then this is not happening.
本文标签: uploadsCan not access txt file which I uploaded through media
版权声明:本文标题:uploads - Can not access .txt file which I uploaded through media 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736654054a1946210.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论