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

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.

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.

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. 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