简体   繁体   中英

Apache 2.4 how to enable rewrite module

I try to enable rewrit module on apache serveur 2.4 and Debian 8 I have created a subdomaine

If I create an php file with :

<?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();
?>

It display "Module Available"

In the global directive (/etc/apache2/apache2.conf) I have create :

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

I have create a .htaccess file on root web folder

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

And an test.html file !

In appache error log I have this :

[Thu Dec 22 11:36:44.828831 2016] [core:info] [pid 1884] [client 83.145.73.220:58115] AH00128: File does not exist: /home/dev/foo.html

Thank for your help

I had the same issue. All you need to do in your terminal is

sudo a2enmod rewrite 

Then just restart apache2

sudo service apache2 restart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM