2016-08-02 128 views
0

我在PHP中制作了一个网站,在本地进行了测试,并且工作正常。现在我把它推到了我的实际网络服务器上,现在我遇到了麻烦,因为我的.htaccess - 文件应该重定向所有呼叫,但它被忽略。.htaccess在Apache上被忽略

这是我.htaccess - 文件

AddDefaultCharset UTF-8 

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] 
    RewriteRule ^(controllers/|core/|models/|views/) - [F,L,NC] 
</IfModule> 

我已经寻找一个解决方案,并运行这些命令想出了:

a2enmod rewrite 
a2enmod expires 
a2ensite default-ssl 

每个命令我重新启动服务器后。

在上面的列表中的最后一个命令给我一个错误:

apache2: Syntax error on line 224 of /etc/apache2/apache2.conf: Syntax error on line 166 of /etc/apache2/sites-enabled/default-ssl.conf: Expected </VirtualHost> but saw </IfModule> 
Action 'configtest' failed. 

是否有人有一个解决方案?

回答

0

查看/etc/apache2/sites-enabled/default-ssl.conf文件。它是否有一个<VirtualHost>开幕词条没有相应的</VirtualHost>闭幕词条?