Apache Virtual Hosts上強制執行RewriteRule

在這位置文件加入以下程式碼 /etc/apache2/sites-available/000-default.conf

AddDefaultCharset utf-8
php_admin_value upload_tmp_dir /var/www/xxxx/
php_admin_value open_basedir /var/www/xxxx
php_value display_errors Off
ServerAlias xxxx.com
ServerName xxxx.com
DocumentRoot /var/www/xxxx
ErrorLog /var/log/apache2/xxxx-error.log
CustomLog /var/log/apache2/xxxx-access.log combined
ServerSignature Off

加入下面程式碼
<Directory "/var/www/xxxx">                      #xxxx是你需要強制執行RewriteRule的文件目錄位置
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>