【问题标题】:Apache 2.4 how to enable rewrite moduleApache 2.4 如何启用重写模块
【发布时间】:2017-05-07 23:22:54
【问题描述】:

我尝试在 apache server 2.4 和 Debian 8 上启用重写模块 我创建了一个子域

如果我创建一个 php 文件:

<?php
 if(!function_exists('apache_get_modules') ){ phpinfo(); exit; }
 $res = 'Module Unavailable';
 if(in_array('mod_rewrite',apache_get_modules())) 
 $res = 'Module Available';
echo apache_get_version();
?>

显示“模块可用”

在全局指令(/etc/apache2/apache2.conf)中我创建了:

<Directory /var/dev/>
 Options Indexes FollowSymLinks                            
 AllowOverride all                                         
 Require all granted                                       
</Directory>

我在根网络文件夹上创建了一个 .htaccess 文件

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^foo.html$  test.html

还有一个 test.html 文件!

在 appache 错误日志中我有这个:

[Thu Dec 22 11:36:44.828831 2016] [core:info] [pid 1884] [client 83.145.73.220:58115] AH00128:文件不存在:/home/dev/foo.html

感谢您的帮助

【问题讨论】:

    标签: apache mod-rewrite


    【解决方案1】:

    我有同样的问题。您需要在终端中做的就是

    sudo a2enmod rewrite 
    

    然后重启apache2

    sudo service apache2 restart
    

    【讨论】:

      猜你喜欢
      • 2018-07-20
      • 1970-01-01
      • 2019-04-22
      • 1970-01-01
      • 2012-08-10
      • 2015-10-06
      • 2015-08-31
      • 2016-12-07
      • 1970-01-01
      相关资源
      最近更新 更多