1.先执行加载rewrite模块
sudo a2enmod rewrite
2.打开apache2.conf
sudo vi /etc/apache2/apache2.conf
把
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
改成
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
3. 确保wordpress工程目录下有.htaccess文件,并且内容如下
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
4、重启apache2
sudo service apache2 restart
- 本文固定链接: https://freemanapp.com/zh/?p=820
- 转载请注明: freeman 于 FreemanApp 发表