0

mod_rewrite PHP module loaded but phpbb URL rewrite option not working

Software Versions:
- Ubuntu 16.04.3 LTS
- Apache 2.4.18
- PHP 7.0
- Loaded Modules: Virtual Server    Yes
Server Root /etc/apache2
Loaded Modules

    core mod_so 
    mod_watchdog 
    http_core 
    mod_log_config 
    mod_logio 
    mod_version 
    mod_unixd 
    mod_access_compat 
    mod_alias 
    mod_auth_basic 
    mod_authn_core 
    mod_authn_file 
    mod_authz_core 
    mod_authz_host 
    mod_authz_user 
    mod_autoindex 
    mod_deflate 
    mod_dir 
    mod_env 
    mod_filter 
    mod_mime 
    prefork 
    mod_negotiation 
    mod_php7 
    mod_rewrite 
    mod_security2 
    mod_setenvif 
    mod_socache_shmcb 
    mod_ssl 
    mod_status 
    mod_unique_id 
    mod_xml2enc

000-default.conf

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerName www.example.net
        ServerAlias example.net
        Redirect /* https://www.example.net/$1

        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/certificate.crt
        SSLCertificateKeyFile /etc/apache2/ssl/private.key

        ServerAdmin [email protected]

        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined         
    </VirtualHost>
</IfModule>

<IfModule security2_module.c>
    SecRuleEngine on
    ServerTokens Full
    SecServerSignature "MyCustomServer/1.12"
</IfModule>

If any more information is needed, ask for it. p.s. I am new to ubuntu

pa4080
  • 29,351
  • 10
  • 85
  • 161
  • Mod Rewrite should be enabled for this directory. [Edit] the question and add the content of your virtual host configuration file. The default one is `/etc/apache2/sites-enabled/000-default.conf`. – pa4080 Oct 04 '17 at 20:40
  • added the config to my post – TheBlueKingLP Oct 05 '17 at 11:52

1 Answers1

0

Modify your configuration file and add the following lines right after the DocumentRoot directive. Then restart Apache.

DocumentRoot /var/www/html
<Directory /var/www/html>
    Options None FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

The directive AllowOverride All should allow all overrides by the .htaccess file for this directory. By default it is: AllowOverride None.

Further reading:

pa4080
  • 29,351
  • 10
  • 85
  • 161
  • Still not working(I already restarted apache2) – TheBlueKingLP Oct 05 '17 at 13:29
  • @TheBlueKingLP: Is there exist `.htaccess` file, writable for Apache's user `www-data`? If not, try to create one: `sudo touch /var/www/html/.htaccess && sudo chown www-data:www-data /var/www/html/.htaccess`. – pa4080 Oct 05 '17 at 13:33
  • still not working... – TheBlueKingLP Oct 05 '17 at 14:11
  • @TheBlueKingLP: What actually should be happen? I've read a bit about phpbb and I think you should add your rules [manually](http://mrbool.com/how-to-go-for-apache-mod-rewrite-and-seo-for-phpbb-forums/25892). Isn't it? – pa4080 Oct 06 '17 at 07:30