Wordpress永久链接永远不会在localhost Ubuntu 12.10上工作


Wordpress Permalinks never work on localhost Ubuntu 12.10

Wordpress永久链接不起作用,除了默认值。如何启用此重写?我试过:

sudo a2enmod rewrite
sudo service apache2 restart

永久链接正在保存到http://localhost/wordpress:中的.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress

我复制到root/var/www只是为了尝试,它没有任何区别。

我也尝试过AllowOverride All,但它在错误的配置文件中,并且坏了。(将此添加到的正确文件是/etc/apache2/站点可用/默认)这是我的解决方案。

13.10的更新

在一个新的安装中,我如上所述使其工作,但进行了以下更改:

您必须使用:

sudo gedit /etc/apache2/sites-available/000-default.conf

并在DocumentRoot /var/www行之后添加以下内容:

<Directory /var/www>
AllowOverride All
</Directory>

如教程所述,运行sudo a2enmod rewrite

设置/var/www/.htaccess文件,然后运行:

sudo chmod 664 /var/www/.htaccess
sudo chown www-data:www-data /var/www/.htaccess

并使用sudo service apache2 restart 重新启动