URL重写在Server中不起作用,但在Localhost中起作用

时间:2012-02-12 14:22:38

标签: 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);

这在我的localhost机器上运行良好,但在Server I主机中不起作用,所以我创建了一个。htaccess文件并在其中写了RewriteEngine On。还是行不通。可能是什么问题

1 个答案:

答案 0 :(得分:1)

我假设你有一些ssh访问你的服务器? 试试这个命令:a2enmod rewrite

并在.htaccess文件中添加一些规则。 see this