简体   繁体   English

当我在WAMP服务器中使用.htaccess文件时出现500个内部服务器错误

[英]500 internal server error comes up when i use .htaccess file in wamp server

i was trying to rewrite my post url with htaccess file when i put it into my project directory with following code in the htaccess file 500 internal error comes up, but when i left it(htaccess) blank without any code the page loads perfectly. 当我将其放入htaccess文件中的以下代码进入项目目录时,我试图用htaccess文件重写我的发布网址500内部错误出现,但是当我将其(htaccess)留空而没有任何代码时,页面将完美加载。

RewriteEngine on
RewriteRule ^post post.php

Error is: 错误是:

Internal Server Error 内部服务器错误

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

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error. 请通过admin@example.com与服务器管理员联系,以告知他们该错误发生的时间以及您在该错误发生之前执行的操作。

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

what might be the issue, is there any permission need to be granted or any directives need to be on in config file or php.ini i am new in php development. 可能是问题所在,是否需要授予任何权限,或者是否需要在配置文件或php.ini中添加任何指令,我是php开发中的新手。 plz help. 请帮助。 Thank you 谢谢

It must be 一定是

RewriteEngine on
RewriteRule ^post$ post.php

try: 尝试:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^post post.php [L,R=301]
</IfModule>

With this code the error should disappear but it's possible that your rule is not applying correctly, in this case we will fix 使用此代码,错误应会消失,但您的规则可能无法正确应用,在这种情况下,我们将修复

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

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