I'm using a shared hosting service for my sites and there is a strange situation.
When any php page is accessed from a link (like Google search results page, etc), the page will not open.
The following error is shown:
"Forbidden you don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."
If the same url is input directly into the browser, the page displays fine.
The situation is not the same for html extension pages, which open properly from links too.
I am not using any .htaccess file.
Permission for files is 644 (I've never changed anything).
This situation is something new, there was not such a problem in the past.
Any advice is welcome.
Related
Very confusing one this...
On the test subdomain only (so NOT on live), any URL which has parameters including %20desc returns the error:
Forbidden
You don't have permission to access this resource.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Doesn't seem to be anything to do with the actual content of the page... I can literally put up a one line text file containing only "Hello" up in a page and it happens:
vs
and it works fine on my live www subdomain:
The test subdomain is on the same linux server... it's literally just in a parallel folder with an identical copy of the site.
Absolutely baffled... anybody?
*Additional thing I've noticed if it helps... it doesn't need the whole "%20desc" to break it... it's down to the presence of just "0desc". Other similar values such as "%20asc" do not cause the problem... just "0desc".
I'm trying to access a streaming page but I get the error "Forbidden. You do not have permission to access this document."
However I can skip this message with F5/refresh and watch the video.
Is there any way to open this URL and do a refresh automatically? (using PHP)
I've tried something like this but it does not seem to work
header("Refresh:0; url=http://www.url.com");
Thank you in advance.
The forbidden access message is most likely coming from your web server configuration (apache?). The browser will stop there, and no document will be loaded from your server.
Since PHP is only interpreted after that, it will actually not get interpreted at all... you have no way to override this behavior in PHP alone, you need to fix your configuration on the server.
If you have a behavior that shows a 403 once every two load, chances are you have either a load balancer type of setup (loading one server or the other), or something that alternate between two configuration (for example issues in your domain name configuration, like the ServerName configuration).
In that case, if you add a header("Refresh:0; url=http://www.url.com"); in your page, you will only get this worse, since the successful load will reload, and then get back to the forbidden message (403).
check your web server config and logs to find the issue.
It's more likely the page is using HTTP REFERER restriction from it's own domain.
If you accessing the page by code, just added the referer condition on it.
In php you can use curl and add this line
curl_setopt($ch, CURLOPT_REFERER, 'domain_url');
I have created a new Page in Wordpress. On this page, I have put the following HTML code:
Please click this link to view the details.
statistics.php has the code to query the backend MySQL database, fetch the details and display in a table format.
however, when I click the link on the Wordpress Page I get a 403 forbidden message.
Forbidden
You don't have permission to access /blog/wp-content/themes/twentytwelve/statistics.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I have tried setting the permissions of the PHP file to both, 644 and 755. Error still persists.
I have even tried putting a simple code like this in the PHP file:
<?php echo "welcome"?>
Even then, the same 403 forbidden error.
Now, I have another page on this Wordpress Site. In that page I have an HTML Form that sends a POST request to a PHP file called process.php which is present in the same directory as statistics.php. That page works properly.
So, I tried replacing the URL in my new page from statistics.php to the process.php. That does not give a 403 forbidden error.
Why is it that I am unable to access one PHP file from my wordpress page? Am I allowed to link only to one external PHP file from wordpress page?
both statistics.php and process.php have the same permissions. However, while one page is able to easily access process.php, the other page gives an error for statistics.php.
Help would be much appreciated.
Thanks.
The directory you have your script under is not readable and neither should it be. It is used by wordpress to store the themes, and this directory can only be read by wordpress in order to output the theme to the front end.
Try placing your scripts in a directory which is not controlled/needed by WordPress. i.e., on your public root, create a new readable directory and place under that directory whichever scripts you need.
I'm running a site under IIS with PHP running in CGI mode. PHP was installed to a pre-existing site so a handler was setup for .html files to be parsed by PHP as well as .php files.
When a non-existent page with a .php extension is requested, a 404 is thrown and user is redirected to the custom 404 page, however when a non-existent page with a .html extension is requested the "No input file specified." error is shown.
I've searched this error and found potential solutions for similar issues but nothing that solves this particular boggle. Any ideas or pokes in the right direction would be much appreciated!
Try the Invoke handler only if request is mapped to file option for the handler under request restrictions.
First. Open "PHP Manager" and check warnings in yellow there. Follow advice there. There is a helpful page to resolve such issues from Microsoft at https://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/using-php-manager-for-iis-to-setup-and-configure-php
Second. Check permissions to the folder of the app. User running AppPool should be given an access.
Hope it helps someone wandered here!
Im trying to load a custom error document for a 404 error using a .htaccess file on a linux server, the page gets the current page URL then redirects to another site (which is retrieved from a db) based on an id it retrieved from the URL.
The current error documents are stored here:
/error_docs/
- i dont have permission to upload anything other than the HTML files that are already in there
/HTTPDocs/301redir.php
is the site root where the .htaccess file is.
i have used the following to load the 301redir.php page as the error doc, which works in FF but no other browsers.
ErrorDocument 404 /310redir.php
using .htaccess is my only real option for changing this, is there a way to get around this issue and make it work across all browsers?
Maybe your file is too small, see the following excerpt from the apache docs:
Microsoft Internet Explorer (MSIE)
will by default ignore
server-generated error messages when
they are "too small" and substitute
its own "friendly" error messages. The
size threshold varies depending on the
type of error, but in general, if you
make your error document greater than
512 bytes, then MSIE will show the
server-generated error rather than
masking it. More information is
available in Microsoft Knowledge Base
article Q294807.
That should work fine, try putting the full URL http://www.yourdomain.com/301redir.php
I also note that youu said 310redir.php is your example but 301redir.php in your description (note 310 and 301).
Also don't forget to add header("HTTP/1.1 404 Not Found"); if you are doing a 404