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
。然后重新启动 Apache。
DocumentRoot /var/www/html
<Directory /var/www/html>
Options None FollowSymLinks
AllowOverride All
Require all granted
</Directory>
该指令AllowOverride All
应允许 .htaccess 文件覆盖此目录的所有内容。默认情况下为:AllowOverride None
。
进一步阅读: