"内部服务器错误500 QUOT;而使用.htaccess文件错误、服务器、文件、QUOT

2023-09-02 00:21:41 作者:落ー地心碎〞没人心疼

可能重复:   

Possible Duplicate: Internal Server Error

我期待改变我在PHP的网站的网址,所以我使用.htaccess文件可以实现,但它显示我的内部服务器错误500

I am looking to change the URL of my website in php, so i am using .htaccess file for this but it showing me Internal Server Error 500.

任何人都可以请帮我如何解决服务器错误?

Can anyone please help me out how to solve the server error?

寻找您宝贵的意见。

推荐答案

找出是什么原因造成的500服务器错误 这里,你可以用它来找出是什么原因造成的错误一些基本的步骤。

Finding out what is causing the 500 Server Error Here are some basic steps that you can use to find out what is causing the error.

打开错误日志工具,设在的cPanel的日志部分。 重新载入网页,导致错误。重新装入错误日志页面。 在搜索错误日志中是否存在错误您的IP地址 与之相关的,您的IP地址位于的顶部 页。 Open the Error Logs tool, located in the Logs section of the cPanel. Reload the web page that is causing the error. Reload the Error Logs page. Search the error logs for your IP Address for any errors associated with it, your IP address is located at the top of the page.

主要有3个原因,你会看到这样的错误:

在文件或文件夹的权限。 为$ C $在你的.htaccess C或语法。 在错误配置的php.ini。

文件或文件夹的权限

【孙六月五日十二点03分22秒2011] [错误] [客户66.249.72.82] SoftException在Application.cpp:601:目录/和home1 / examplec /的public_html可写入按组

[Sun Jun 05 12:03:22 2011] [error] [client 66.249.72.82] SoftException in Application.cpp:601: Directory "/home1/examplec/public_html" is writeable by group

在这种情况下,您的账户与无效的权限集的文件夹。为了解决这个问题,只需从777还原权限为755 虽然每个站点可以是不同的,下面的权限是最经常使用正确的权限:

In this scenario, your account has a folder with an invalid permission set. To correct this, simply restore the permissions to "755" from "777." While each site can be different, the following permissions are most often the correct permissions to use:

文件 - 644 CGI脚本 - 755 目录 - 755

Files - 644 CGI Scripts - 755 Directories - 755

您可以修改与文件管理权限,坐落在的cPanel,FTP客户端,或者使用SSH /猛砸CHMOD命令的文件类型。 有关如何更改文件​​和文件夹的权限,请参阅我们的知识库文章设置文件和用户权限的更多信息

You can modify permissions with the File Manager, located in the Files category of the cPanel, an FTP client, or using the "chmod" command in SSH/Bash. For more information on how to change File and Folder permissions please see our Knowledge Base article Setting file and user permissions

在你的.htaccess 坏code或语法

Bad code or syntaxes in your .htaccess

有一个巨大的一系列事情的.htaccess可以做的,而不是难用,但是如果你没有输入正确的语法,它可以导致服务器的500错误。的什么可能会导致错误的一些常见的例子在下面列出。

There is a huge range of things .htaccess can do and isn't difficult to use, however if you do not enter the syntax correctly it can result in a Server 500 Error. Some common examples of what could cause an error are listed below.

语法没有关闭

[太阳6月5日12时十一分38秒2011] [警惕] [客户66.249.72.82] /home1/examplec/public_html/.htaccess:/home1/examplec/public_html/.htaccess:3:ExampleRule /模块>是未关闭。

[Sun Jun 05 12:11:38 2011] [alert] [client 66.249.72.82] /home1/examplec/public_html/.htaccess: /home1/examplec/public_html/.htaccess:3: ExampleRule/Module> was not closed.

此外,该解决方案是简单地解决语法,或将其删除。在这种情况下,关闭的结局,指令正确,并把自己的线的规则来解决问题。

Again, the solution is to simply fix the syntax, or remove it. In this case, close the ending "" directive properly and put the rules on their own line to resolve the problem.

这些只是能坏的.htaccess参数引起的一些常见的例子。你遇到什么可能会有所不同,但一般的错误信息是足够的描述来确定它的一个错误,而不进一步调查。 配置不当的php.ini ForceType指令

These are just a few common examples that can be caused by bad .htaccess parameters. What you encounter will likely vary, however generally the error message is descriptive enough to determine an error from it without further investigation. Improperly configured php.ini ForceType

当您使用文件(或没有)不同的扩展,则正常扩展为对文件类型,您可以使用ForceType指令在你的.htaccess文件,使之清楚,服务器如何处理文件(或所有文件该文件夹)(这适用于服务器,而无需phpsuexec)。

When you are using files with (or without) an extension different then the normal extension for that filetype you can use ForceType in your .htaccess file to make it clear to the server how to handle that file (or all the files in the folder) (this works on servers without phpsuexec).

一个例子:当你有一个名为项的文件(如核用来FancyURL的),并希望它被作为PHP您使用以下code。在你的.htaccess文件服务器解析:

An example: When you have a file called 'item' (like Nucleus uses for FancyURL's) and want it to be parsed by the server as php you use the following code in your .htaccess file:

ForceType application/x-httpd-php

但是,由于我们的服务器使用phpsuexec这将导致内部服务器错误。为了解决这个问题,你可以简单地使用SetHandler代替ForceType指令,让你的.htaccess文件就变成了:

However, because our servers use phpsuexec this will result in an internal server error. To solve this you can simply use SetHandler instead of ForceType, so your .htaccess-file becomes:

SetHandler application/x-httpd-php

php_value 在没有phpsuexec服务器,可以使用php_value语句.htaccess文件改变PHP的设置(实际上是覆盖在php.ini中的设置)。在具有phpsuexec一个断绝,这也将导致服务器错误。为了解决这个问题,你可以使用你放在同一文件夹中,你将不得不把你的.htaccess文件中的php.ini文件。在该php.ini文件,你可以改变所有的php价值。你只要把你想要在该文件中修改值。举例,如果你想设置short_open_tag的值为关你会使用short_open_tag的值为? =掉在你的.htaccess文件。使用php.ini文件这导致:

php_value On a server without phpsuexec it is possible to use the php_value statement in a .htaccess file to change the settings of php (actually overwrite the settings from php.ini). On a sever with phpsuexec this will also result in a server error. To solve this you can use a php.ini file which you put in the same folder as where you would have put your .htaccess file. In that php.ini file you can change all the php values. You only have to put the values you want to modify in that file. By example if you want to set the short_open_tag to Off you would have used short_open_tag? = off in your .htaccess file. Using a php.ini file this results in:

[PHP]
short_open_tag = Off