mod_rewrite 已加載,但 phpbb url 重寫選項不起作用

mod_rewrite 已加載,但 phpbb url 重寫選項不起作用

mod_rewrite PHP 模組已加載,但 phpbb URL 重寫選項不起作用

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-預設.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>

如果需要更多信息,請詢問。 ps我是ubuntu新手

答案1

修改您的設定檔並在指令後面新增以下行DocumentRoot。然後重新啟動阿帕契。

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

該指令AllowOverride All應允許該目錄的 .htaccess 檔案進行所有覆蓋。預設情況下它是:AllowOverride None

延伸閱讀:

相關內容