我的 .htaccess 文件出现以下错误
当我在子域上使用 htaccess 文件时,出现内部服务器错误,但它在标准域中工作正常。我真的不明白 htaccess 文件是如何工作的,所以任何帮助都会非常有帮助。
.htaccess 文件
RewriteEngine on
RewriteRule ^([^/\.]+)\.html index.php?act=$1 [L]
内部服务器错误
服务器遇到内部问题 错误或配置错误,并且是 无法完成您的请求。
请联系服务器 行政人员, [电子邮件受保护] 并告知他们错误发生的时间 发生了,以及你可能遇到的任何事情 这样做可能会导致错误。
有关此错误的更多信息可能会 可在服务器错误日志中找到。
此外,还有一个 500 内部服务器 遇到错误错误 尝试使用 ErrorDocument 来 处理请求。
I am getting a Internal Server Error when i use my htaccess file on a sub domain but it works fine with standard domains. I dont really understand how the htaccess file works totally so any help would be greatly aprricated.
.htaccess file
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,
[email protected]
and inform them of the time the error
occurred, and anything you might have
done that may have caused the error.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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 RewriteRules 时,请始终使用与所涉及模块关联的条件。如果模块不可用,重写将不起作用(并且您的网站可能会被破坏,因为它依赖于重写规则;-)),但您不会收到 500 错误:
如果您没有收到 500 错误此后,重写模块不会加载到您的子域中。
如果您仍然看到它,则可能是重定向循环。
When using RewriteRules, always, always use the conditions associated with the involved module. 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:
If you don't get a 500 error after this, then the rewrite module is not loaded in your subdomain.
If you still get it, it's probably a redirect loop.
这是一次弃踢——可能大错特错。
您的子域是否基于标准 webroot 内的文件夹?
即 subdomain.server.com 根植于 server.com 的 webroot 文件夹内的文件夹 subdomain 中。因此,网络根目录类似于 /httpdocs/,子域为 /httpdocs/subdomain/。
您可能只需要将 RewriteBase 定义为该文件夹
有帮助吗?
This is a punt - may be well off base.
Is your subdomain is based in a folder within the standard webroot?
ie subdomain.server.com is rooted in a folder subdomain within the webroot folder for server.com. So the webroot is something like /httpdocs/ and the subdomain is /httpdocs/subdomain/.
You may just need to define the RewriteBase as that folder
Does that help?