I am trying to set up my website on VPS (Virtual Private Server). When I browse a static file like abc.html it works well. However when I try to browse a file that has database connection I get 500 error: The request was not completed. The server met an unexpected condition.
So I thought my mysql credentials would be wrong. But they seem to be correct. When I go into CPanel and check the logs I find this:
[Sat Jun 02 08:19:26 2012] [error] [client XXX.XXX.XXX.XXX] File does not exist: /home/abv/public_html/abv/Connections/sys_cpanel, referer: http://XXX.XXX.XXX.XXX/~abv/abv/Connections/PowerCMSConnection.php
Googling it suggests that I have something wrong in my .htaccess file. But if it would have been wrong then why would the files that don't use database connection work?
Anyways, this is my .htaccess file:
##########################################
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\$ $1.html [nc]
Redirect 301 /business.html http://www.something.com/corporate-production-video
Redirect 301 /events.html http://www.something.com/london-videography
Redirect 301 /property.html http://www.something.com/property-on-video
Redirect 301 /weddings.html http://www.something.com/weddings-videographer
Redirect 301 /contact_us.html http://www.something.com/production-companies-music-video
Can somebody suggest what the error can be?
If your browser support Private Browsing (Fifefox, Incognito for Google Chrome and InPrivate for Internet Explorer), try opening the site after initializing such private browsing mode.
A while ago when I was configuring my webserver for redirects, it turned out that the browser saved the first redirect setting (301 means permanent redirection), and even though I altered the configuration and rebooted the server, my browser was using the same, bad, locally cached data. The issue for me was cleared after checking in private browsing mode.
Related
Well I have been having a tough time trying to figure out the reason for getting the forbidden error message on my wamp server.
I have a folder website_ink inside c:/wamp/www/ folder. when I access
http://localhost/website_ink/
the index page loads fine. But when i try to access any other page it gives me a forbidden error message.
The url i tried accessing was http://localhost/website_ink/cloud-plans.
This page does exist inside my root directory meaning inside website-ink/cloud-plans.php page does exist.
This is the error I find when visiting the url on browser
Forbidden
You don't have permission to access /website_ink/C:/wamp/www//website_ink/cloud-plans.php on this server.
Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80
This is the error message i found in the log file
The given path is misformatted or contained invalid characters: [client 127.0.0.1:60811] AH00127: Cannot map GET /website_ink/cloud-plans HTTP/1.1 to file.
I do not have any virtual hosts setup or anything fancy. Also I tried upgrading from Apache 2.2 to Apache 2.4. Currently I am using Apache 2.4.
Please help
The reason why it happens is you try to open "/website_ink/cloud-plans" instead "/website_ink/cloud-plans.php".
In case you want to use path wiht out file extension you need add rewrite rule to .htaccess or httpd.conf:
RewriteEngine on
RewriteRule ^/(website_ink/.*)/$ /$1.php [L,QSA]
Also you need mod_rewrite to be installed and enabled
I'm trying out mod_rewrite on a local playground using MAMP (I know), the rule I'm using seems to be fine according to answers here on stackoverflow, but I keep getting a 404 page, even tried looking at the apache server log, and it seems to be missing the file extension even though the rewrite rule includes it.
Here is my rule:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteRule ^test/([0-9]+)/$ public/test.php?id=$1 [NC,L]
Apache log entry:
[Sat Mar 02 00:24:02 2013] [error] [client 127.0.0.1] File does not exist: /Applications/MAMP/htdocs/site/public/test
I have verified it works by placing the same htaccess file inside the sub directory, instead of the root, oddly enough, that works.
The issue seems to be related to the fact .php is missing (based on the apache log).
While my website works fine on my local environment (MAMP) when I upload the files to my server (bluehost), I run into the following issue:
I have a link with a php get variable (i.e. /xxx.php?p=bob) that invokes a javascript function (popitup) that opens a pop-up window.
The link is structured as follows:
<?php echo "<a href='media_player.php?p=".$listen_now."' onclick=\"return popitup('media_player.php?p=".$listen_now."')\">"
The popitup function is defined as follows:
function popitup(url) {
newwindow=window.open(url,'name','height=700,width=375');
if (window.focus) {newwindow.focus()}
return false;
}
When the pop-up window opens, the page contents do not load, and I get the following message:
[an error occurred while processing this directive]
The main error log shows the following warning:
[Mon May 28 08:23:40 2012] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.
The .htaccess file in my public_html folder does not contain any redirects or rewrites.
Any leads on how I might solve this issue are very much appreciated.
RewriteCond warnings come from Apache's mod_rewrite. You have a broken rewrite rule in either:
.htaccess (directory of .php file or in any directory up the tree to the system root)
Virtual Host configuration
main apache configuration
Find its location and fix it there.
I have website on one host(host A) and another website which I include with iframe(on host B).
From that iframe I would like to go to one of my pages from my host A, but I get this error
You don't have permission to access
/pages/online.php on this server.
Additionally, a 404 Not Found error
was encountered while trying to use an
ErrorDocument to handle the request.
How can I fix that? It worked good when I was using another server.
Apache error logs:
[Fri Jul 01 03:24:37 2011] [error] [client some-ip-here] File does not exist: /home/etcorg/public_html/proba/500.shtml, referer: proba.etc.org.rs/pages [Fri Jul 01 03:24:37 2011] [error] [client x.x.x.x] SoftException in Application.cpp:256: File "/home/etcorg/public_html/proba/pages/online.php" is writeable by group, referer: somepage.com
I think your host has program that checks that the permissions aren't set too high (over 644). Thus the error. Change all the rights to 644 for files and 755 for directories.
Check the reading rights on this file on the server for Apache user.
Try to use full URL in your iframe (ex: http://www.SiteB.com/pages/online.php)
The error
You don't have permission to access /pages/online.php on this server.
Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.
means that location /pages/online.php could not be accessed because of lacking permissions. If the file is supposed to be a PHP script, it should be readable (but highly probably not writable) by the web server process.
In addition, the server tried to use custom error page for the HTTP 500 internal server error situation but the server was incorrectly configured and displaying the custom error page failed as a result. (Error message hints about ErrorDocument configuration directive which makes this server almost certainly an Apache server.)
To fix the first error, you may need to change access bits for the script and to fix the second error, you must check where Apache ErrorDocument configuration points to. Perhaps there's a typo in the configuration or some file is missing?
So, we've got PHP 5.3.2 installed on a Windows 2008 R2 Server. PHP.ini file is loaded, everything looks good on that end. We are also running IIS 7.5 and ISAPI_Rewrite. We have a PHP-based CMS installed and it runs dandy.
The problem lies with posting variables. Example:
We have a contact page: http://example.com/contact with a form that posts the variables on submit via PHP.
But then, when a user submits the form, it seems as if any page with variables POSTed (like this one) end up returning a 500 error.
EDIT I have another idea: Not sure whether it could have to do with the .htaccess files. This server gives 500 errors for, like, everything.
The CMS we're using passes everything through an index.php file, so our .htaccess file takes index.php out of the url so that urls are clean.
RewriteEngine on
RewriteCond $1 !^(images|documents|admin|themes|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]
The headers for the posted-to page are as follows:
Request URL:http://domain.com/
Request Method:POST
Status Code:500 Internal Server Error
**Request Headers**
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png;q=0.5
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Content-Type:application/x-www-form-urlencoded
I could be way off here, but is there some sort of regex or setting I missed in IIS that any .php file with post variables is just not assigned to get picked up by PHP?
*EDITS / UPDATES *
I RDC'd into the computer to test, and also turned on Detailed error reporting.
The website, with clean URLs, works fine until submitting a form.
Server error: HTTP Error 500.0 - Internal Server Error
The FastCGI process exceeded configured activity timeout (it took a while)
Handler: PHP5
And then in the logs:
2011-01-12 16:57:56 10.64.181.170 POST /index.php/ - 80 - 10.64.181.170 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.1; +WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727; +.NET4.0C;+.NET4.0E) 500 0 258 82850
--Steph
I encountered this today on a customer website.
This customer was using UMBRACO as their CMS and had a large web.config file in the root of the site.
My background is in Linux rather than Windows, however after randomly shotgun-removing lines from the web.config, I discovered the problematic line was something like:
<trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
If you are still having this problem, check to see if you have a web.config in the root of the site with a line similar to this in it. Commenting it out seemed to do the trick, I'm not sure what it is used for.
IIS does not natively support .htaccess files and rewrite rules. To work around that you need to:
Install URL Rewrite for IIS
In IIS manager for your site double-click URL Rewrite
Click Import Rules
Locate your .htaccess file on the disk
Click Import
Review and click Apply
IIS rewrite rules will get saved as web.config XML file. Conversion works out-of-the-box for most rewrite rules.