Php URL重写在服务器中不起作用,但在本地主机中起作用

Php URL重写在服务器中不起作用,但在本地主机中起作用,php,apache,url-rewriting,Php,Apache,Url Rewriting,我的config.php文件中有一段代码 // If URL-Rewriting does not work then set // define('BASE_PATH',BASE_DIR.'/index.php'); // If URL-Rewriting works, then leave the line below as is define('BASE_PATH',BASE_DIR); 这在我的本地主机上运行良好,但在我所托管的服务器上不起作用,因此我创建了一个。htaccess文件,

我的config.php文件中有一段代码

// If URL-Rewriting does not work then set
// define('BASE_PATH',BASE_DIR.'/index.php');
// If URL-Rewriting works, then leave the line below as is
define('BASE_PATH',BASE_DIR);

这在我的本地主机上运行良好,但在我所托管的服务器上不起作用,因此我创建了一个。
htaccess
文件,并在其中编写了
RewriteEngine。仍然不起作用。可能是什么问题?

我假设您对服务器有一些ssh访问权限? 尝试此命令:
a2enmod rewrite


并向.htaccess文件中添加一些规则

您确定服务器启用了mod_rewrite吗?在.htaccess中还有什么
RewriteEngine on
仅启用它,您还需要指定一些规则。modrewrite.tags已启用。。.htaccess文件仅包含一行。。发动机开着。。这是因为我使用的是来自。。。在我的本地主机上,即使没有modrewrite,它也能用seo友好的urlstanks@helle运行。。但我刚刚发现。。从我的托管提供商那里得知,我需要升级我的帐户才能访问它?当给出
phpinfo()时,您可以通过读取打印出来的信息进行检查是modrewrite.tags已启用