Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess URL重写在本地MAMP上有效,但在主机上无效?_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess URL重写在本地MAMP上有效,但在主机上无效?

.htaccess URL重写在本地MAMP上有效,但在主机上无效?,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我的(dot)htaccess文件: RewriteEngine On RewriteRule ^movie/([a-zA-Z0-9-/]+)/$ movie.php?id=$1 RewriteRule ^movie/([a-zA-Z0-9-/]+)$ movie.php?id=$1 RewriteRule ^actor/([a-zA-Z0-9-/]+)/$ actor.php?id=$1 RewriteRule ^actor/([a-zA-Z0-9-/]+)$ actor.php?id=$

我的(dot)htaccess文件:

RewriteEngine On

RewriteRule ^movie/([a-zA-Z0-9-/]+)/$ movie.php?id=$1
RewriteRule ^movie/([a-zA-Z0-9-/]+)$ movie.php?id=$1

RewriteRule ^actor/([a-zA-Z0-9-/]+)/$ actor.php?id=$1
RewriteRule ^actor/([a-zA-Z0-9-/]+)$ actor.php?id=$1

RewriteRule ^topfilms/$ topfilms.php
RewriteRule ^topfilms$ topfilms.php

RewriteRule ^topactors/$ topactors.php
RewriteRule ^topactors$ topactors.php
在我的基于MAMP的本地主机服务器上,上述操作非常有效。但是,当我将脚本上传到我的web主机时,它不起作用,我得到一个500内部服务器错误

文件权限没有问题,而且似乎只有上述htaccess存在问题


但是,我不明白这是什么

您的主机是否已启用mod_rewrite并允许通过
.htaccess
覆盖配置。根据您的描述和错误,我想不会。删除.htaccess并确保您的PHP代码正常工作,这是第一步。第二步查找错误日志文件,看看是否有任何相关错误。@nmaier Yes,mod_rewrite肯定已启用。@Prix代码工作正常,因为当我使用/movie.php?id=10以标准方式访问URL时,所有内容都显示正确。@RohitSmith检查某些主机的错误日志,如果有重写错误,他们会将其转储到这些主机上。