永久链接设置

1) 进入wordpress 后台,更改固定链接为 /%postname%.html
2) AllowOverride ALL 现在apache2不依靠httpd.conf来配置。 Ubuntu下默认的配置文件是/etc/apache2/sites-available/default 可以修改上面文件来修改apache2配置,

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all

3) 开启module: rewrite

使用指令:a2enmod rewrite

4) 修改.htaccess为:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

5) 重启 apache2

使用指令:sudo /etc/init.d/apache2 restart
或:sudo service apache2 restart

你可能感兴趣的:(永久链接设置)