Sudden forbidden access to wp-admin beacuse of .htaccess file problem - php

I am currently having a very sudden problem with a website. It was working fine but now when trying to access the wp-admin I get the following 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.
I found the .htaccess file in the bluehost login and the permissions are 664, and it seems a have another identical .htacess file in another folder, I don't know if that may be causing the problem.
The .htaccess file looks like this
<FilesMatch ".(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|suspected)$"> Order Allow,Deny Deny from all </FilesMatch>
Actually all of my .htaccess files have a editing date two days ago and I don't get why.

Related

Directory access is forbidden error in CodeIgniter

When I tried to access a folder in localhost, I got:
Directory access is forbidden. 403 forbidden
I had followed a tutorial for CodeIgniter.
So I deleted the .htaccess file, but still can't solve the problem.
Maybe the httpd.conf has some settings wrong?

Forbidden Error 403 On Server Folder

I'm trying to host a new blog where I can add posts using a simple HTML form & PHP script. When I test out the form on my localhost everything works fine, but when I upload it and test it live I get:
Forbidden
You don't have permission to access /php/add-post.php on this server.
Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.
I know that my host allows this type of script because I'm using exactly the same thing on another blog, and my permissions are set to 0755. Does anyone know what the problem might be & how to solve it?
Add the below code in .htaccess file
<Files add-post.php>
Order Deny,Allow
Deny from all
Allow from all
</Files>
Or run command to provide permission to folder
chmod 774 /path/to/php/add-post.php

How to add a new .php page/view in a subdirectory of a my website which contains a .htaccess file?

I'm using this php login script as a jumpstart for my website
This is my directory listing for the views folder of my site:
>_installation
>classes
>config
>libraries
>views
.htaccess
logged_in.php //works fine
newpage.php //new page returns a Error 403
not_logged_in.php //works fine
register.php //works fine
index.php
register.php
The file .htaccess file in views folder contains:
# This file prevents that your .php view files are accessed directly from the outside
<Files ~ "\.(htaccess|php)$">
order allow,deny
deny from all
</Files>
I'm wondering why the newly added nawpage.php in the same folder views returns an Access forbidden! Error 403 everytime I access it. But, the remaining .php files in views works perfectly.
This is the complete error details:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
127.0.0.1
Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.11
Can someone help me fix and understand this? Thank you so much.
Well, Let me answer your question.
You can read your php file for example you can write your index.php file
include "view/newpage.php";
It will work fine. But you can't access view folder any file directly from your browser. You can access these file from your php code or only from that server end.

Joomla 403 Forbidden when trying to access php file

I have a Joomla site. I've created a subfolder with a landing page.
This landing page was coded in HTML + CSS. This works perfectly but now I have added a little PHP plugin to manage MailChimp subscribers. But when I try to access to the php file, the server throws the following 403 error:
Forbidden
You don't have permission to access http://www.domain.es/folder/sub-folder/server.php
I have changed the .htaccess file to allow PHP files the following way (but it doesn't work):
<FilesMatch *.php$>
Allow from all
</FilesMatch>
Any ideas?
Try renaming server.php to myfile.php and see if you still have the same problem. It might be that your Apache server configuration has a rule to block server.php because, in many instances, files that have server.php as their name are malicious.

Problems Blocking Access to Single File with .htaccess

So, all I'm attempting to do with this .htaccess file is prevent anybody that isn't the server from being able to view the file e-mails.txt. The server needs access to it for a php script(using fopen). Everything I've read says this should work, but this is preventing any file in the directory, and subdirectories from what I can tell, from being accessible.
<Files e-mails.txt>
Order deny, allow
Deny from all
</Files>
Also, before when .htaccess was similar, it wasn't blocking the entire directory, but it was preventing the .php script to function properly, which is what caused me to delete it, which fixed the .php script but let e-mails.txt be visible to everyone. So then, when I re-created it and used the above code, the entire site/directory is spitting out a 500 error.
May be, you can write a rewrite condition for this file to 404 or 500 error page. This method render impossible access over http.

Categories