Wordpress Server unable to read htaccess file, denying access to be safe - wordpress

I am running wordpress on my own managed server so I have complete access to the box. The issue I'm having is that users can upload images to my image library but any uploaded are not loading due to 403 errors.
When I go directly to one of the images I get the message "Server unable to read htaccess file, denying access to be safe"
I have set the permissions on the .htaccess file and all files to 775 but it made no difference.
I also tried nuking the file and uploading a new .htaccess from a fresh wordpress download in case it was corrupted but it made no difference.
The strange thing is the images do display in one context, when you use the wordpress image editor.
Not sure what to do about this, I'm a drupal developer and only have a passing familiarity with wordpress.
Example working legacy image:
http://www.bonnybridgeanglingclub.com/wp-content/uploads/2016/06/DSC_0671.jpg
Example broken recent image:
http://www.bonnybridgeanglingclub.com/wp-content/uploads/2017/02/652-1024x640.jpg
Any help would be greatly appreciated.

It turned out the problem was that for some reason when the 2017 directory was created inside the uploads folder it was created with the wrong permissions, very odd, I've fixed the permissions and all is well now.

Related

You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe

I wanted to updated my Wordpress site, before updating I took backup for the entire website folder and so I installed an updated theme but later I decided to remove the update by deleting the whole website folder and put back the backup folder. after that I get this error
Forbidden
You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
my site is Business Directory in Tanzania
I assume you sorted out your htaccess issue, as I can see your website loading.
But, as it stands now, a lot of your static assets (css and images) aren't loading.
Seems some type of an issue with your Amazon Cloudfront configuration - I'd clear the Amazon cache and see if that resolves it.
If not, turn it off, and try to debug
I checked the data base on myphpadmin and I found out it was deleted, so I created another one with same credentials like on wp-config, and now it works fine. Thanks much

Can't Upload Images or Plugins via Wordpress Admin

I have a website that I just transferred from one server to another. I did this by copying all the files via FTP from the old server to my computer and then to the new server. I changed the URL in Settings to the new url and I downloaded a copy of the database. I then uploaded the database to the new server and changed all the database info in the wp-config file. Afterwards I used Velvet Blues Update URLs to make sure all the URLs have been changed in the database.
After doing all the the website is working fine. I could update my plugins and my WordPress core files that needed updated.
The problem is now I can't upload a plugin from my computer or any media files like images. When uploading an image, I get this message:
“image.jpg” has failed to upload.
Unable to create directory uploads/2017/03. Is its parent directory writable by the server?
I checked and this directory is already on the server. In FTP I changed the folder permissions to all be set to 775.
I then tried to change the folder structure for media files to not be broken into month/date folders and I get this message:
“image.jpg” has failed to upload.
Unable to create directory uploads. Is its parent directory writable by the server?
I know this directory exists and is set to 775. To double check I also change the wp-content directory to the same permissions.
What am I doing wrong here? Why can't I upload images and plugins via the WordPress backend?
I actually think I figured this out. I went into Settings -> Media and noticed there was a box that says Store Uploads to This Folder and had a folder for the old website. I deleted the information that was in that box and updated the settings and now it works!
I had this exact issue today. After much troubleshooting, I solved this images not uploading issue -- specifically, when I clicked the upload button, no dialog window appeared. As a new WordPress installation, the dashboard was displaying asking if this was going to be a business or personal site. When I clicked I DON'T NEED ANY HELP, then I saw the normal dashboard with WooCommerce module displayed and I was able to upload media files and images from my hard drive.
I'm posting in case this answer can help someone else having this very weird problem. Also, it is possible that a plugin like OpinMonster might be what generated that "business or personal" message.

Editing .htaccess without FTP access through Wordpress

I have no access to my FTP but I'm able to edit the web through Wordpress. Is there any way I could perhaps generate the .htaccess file through the admin framework? I know there might be a plugin to do that, but bear in mind I have no FTP access and the plugins require it to be installed.
I need the .htaccess file to redirect the user to another site.
I know this might strike you as weird and stupid, but this is due to the company's central decision to keep the site hosted by, I guess, a "friendly" hosting company. There's no way of recovering the login/password for FTP, so this might be the only solution.
Please, try posting constructive comments only, no "contact the hosting company". If I could, I would.
If your hosting company has set up wordpress correctly, then there is no way to do this, because unix permissions should make .htaccess read-only to the owner of the web server.
If the company has not done this, and if you have a way to change the templates, you might have success by creating a template that contains php code to open and write the .htaccess file.
Sample code to be put at the top of the header.php:
echo 'Current dir: ',getcwd(),"<br>\n";
if ($handle=opendir('.')) {
while (($file=readdir($handle))!==false) {
$ok=(is_writable($file) ? "ok" : "can't write");
echo "file '$file': $ok<br>\n";
}
closedir($handle);
}
This is to test you're in the root directory of your wordpress installation. It should give you the current directory, a list of all files in that directory (expect .htaccess, index.php, and various wp-* files), and their writability.
Once you've checked everything is correct, add
file_put_contents('.test', "RewriteEngine On\nRewriteRule ^(.*)$ site.com$1 [R=301,QSA,L]\n");
echo("<code><pre>-------- included file starts here\n");
include(".test");
echo("-------- included file ends here</pre></code>\n");
to the php code. This writes to a test file and includes it so you can check if everything is ok. When you've checked the file contents, replace .test with .htaccess.
WARNING: You should be VERY sure about the content of .htaccess. file_put_contents doesn't append the new string, it overwrites the whole file. Once you've written a bad .htaccess file, you might not be able to ever change it again, because the web server will redirect you to the new site instead of executing the script on the old site.
I am sorry for your situation. What is the hosting company (will keep this in mind if I ever use them). To try to help:
Do you have access to CPanel? Most hosting providers give it out of the box. Cpanel has a file manager.
Research Wordpress file managers (http://wordpress.org/plugins/wp-filemanager/)
How to edit wordpress .htaccess file from hosting Cpanel: If you are currently unable to login in your wordpress dashboard, or facing 500 internal server error. There is 90% possibility that you were editing your .htaccess file from your wordpress dashboard. In this situation you can only fix your wordpress .htaccess file by editing it from cpanel. Editing .htaccess file from wordpress dashboard is little risky with .htaccess editor plugins. If you will implement any wrong code then you might face 500 internal server error and your site might crush. So first you should take a backup of your existing .htaccess file before editing it. If you have a backup of your wordpress .htaccess file then you can upload it through your hosting cpanel also.
https://howtoways.com/how-to-edit-wordpress-htaccess-file-from-hosting-cpanel/

Wordpress media upload : Error 500

When I try to upload images on multiple WP websites hosted on a particular server, via the Flash uploader, I get a HTTP Error written in red.
I know that this is a common problem, but the common solutions don't work for me. This is why I try to ask it as a new question.
Here is what I tried so far :
Fresh WP copy
Folder / file permissions on wp-content/uploads and .htaccess
Delete .htaccess
Switch to Regular uploader which leads me to a Internet Server Error 500 when I try to upload files
Switch theme
Disable all plugins
The mod_security fix
Tested the site on my local server, and it did work correctly but I have no idea why.
Thank you!

WordPress and Windows IIS Server Problems

I am currently working on a WordPress project on a remote IIS server. I consider myself well versed in the use of WordPress, however, most of my previous projects have been on Apache servers and I am really running into problems on the IIS server.
I have contacted the host, and made sure that I have the correct file permissions. However, I cannot upload files or edit themes/plugins from the WordPress backend.
For example, when I use the WordPress theme editor panel, I make changes in the text, but when I click save there is no "Your changes have been saved message" and the file is just reverted to what it was before.
When I try to upload an image inside a post, I receive the following message:
The uploaded file could not be moved to C:\xxx\wwwroot\xxx.com\www\dev/wp-content\uploads.
I notice the slash to the right of dev is incorrect, but I cannot figure out how to change this. I have tried defining this in the wp-config file with several different variations with no luck. For example, I have tried adding define('UPLOADS', '\wp-content\uploads') and I have also tried using the absolute path.
Does anyone have any idea how I can fix this? I need to get this squared away as soon as possible, but I am not sure where to go from here. Any advice is appreciated.
Thank you for reading.
.
.
.
Edit
I have tried altering the "upload_path" via wp-admin/options.php with no success, and the following results:
When I try the absolute path, C:\xxx\wwwroot\xxx.com\www\dev\wp-content\uploads, I get the following
The uploaded file could not be moved to C:\xxx\wwwroot\xxx.com\www\dev\wp-content\uploads.
When I try wp-content\uploads in the "upload_path", I get the following
The uploaded file could not be moved to C:\xxx\wwwroot\xxx.com\www\dev/wp-content\uploads.
Chris's Blog » Wordpress upload permissions on IIS 7 Fix or Google for the IIS6 fix:
...You need to give the IUSR account Read/Write/Modify permission on
your wp-content folder.... and you need to give the IIS_IUSRS group
Read permissions on your “C:\Windows\Temp” folder.
See 10 Reasons Why Not to Host Your Wordpress Blog on a Windows/IIS Platform
you need to give php temp dir full permissions (iusr) (network service) c:\winnt\temp is the default upload dir before it moves to the wp site so this has to be set
in php admin (in iis applet) u can change the temp dir if your not liking the fact its in your NOS dir
next issue u will have is max_fileupload size also in php admin
iis works great best if your the admin of the server to quickly make the needed changes

Resources