简体   繁体   English

我的.htaccess文件出现以下错误

[英]I am getting the following error with my .htaccess file

I am getting a Internal Server Error when i use my htaccess file on a sub domain but it works fine with standard domains. 当我在子域上使用htaccess文件时出现内部服务器错误,但在标准域中可以正常工作。 I dont really understand how the htaccess file works totally so any help would be greatly aprricated. 我真的不太了解htaccess文件是如何工作的,因此将不提供任何帮助。

.htaccess file .htaccess文件

RewriteEngine on
RewriteRule ^([^/\.]+)\.html index.php?act=$1 [L]

Internal Server Error 内部服务器错误

The server encountered an internal error or misconfiguration and was unable to complete your request. 服务器遇到内部错误或配置错误,无法完成您的请求。

Please contact the server administrator, webmaster@-----.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. 请与服务器管理员webmaster@-----.com联系,并告知他们错误发生的时间以及您可能做的任何可能导致错误的事情。

More information about this error may be available in the server error log. 服务器错误日志中可能会提供有关此错误的更多信息。

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. 此外,尝试使用ErrorDocument处理请求时遇到500内部服务器错误错误。

When using RewriteRules, always, always use the conditions associated with the involved module. 使用RewriteRules时,请始终始终使用与所涉及模块相关的条件。 In case the module is not available, rewrites won't work (and your website will probably be broken because it relies on rewrite rules ;-)) but you won't get a 500 error: 万一该模块不可用,重写将不起作用(并且您的网站可能会因为依赖于重写规则而被破坏;-)),但不会出现500错误:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^([^/\.]+)\.html index.php?act=$1 [L]
</IfModule>

If you don't get a 500 error after this, then the rewrite module is not loaded in your subdomain. 如果之后没有出现500错误,则说明重写模块未加载到您的子域中。

If you still get it, it's probably a redirect loop. 如果仍然可以得到,则可能是重定向循环。

This is a punt - may be well off base. 这是一个平底锅-可能不太理想。

Is your subdomain is based in a folder within the standard webroot? 您的子域是否位于标准webroot内的文件夹中? ie subdomain.server.com is rooted in a folder subdomain within the webroot folder for server.com . subdomain.server.com植根于server.com的webroot文件夹内的文件夹子 域中 So the webroot is something like /httpdocs/ and the subdomain is /httpdocs/subdomain/ . 因此,webroot类似于/ httpdocs / ,子域为/ httpdocs / subdomain /

You may just need to define the RewriteBase as that folder 您可能只需要将RewriteBase定义为该文件夹

RewriteEngine on
RewriteBase /subdomain/
RewriteRule ^([^/\.]+)\.html index.php?act=$1 [L]

Does that help? 有帮助吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM