Wordpress Permalinks永远无法在localhost Ubuntu 12.10上运行 [英] Wordpress Permalinks never work on localhost Ubuntu 12.10

查看:88
本文介绍了Wordpress Permalinks永远无法在localhost Ubuntu 12.10上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除默认设置外,Wordpress永久链接无效.如何启用此重写?我尝试过:

Wordpress permalinks aren't working, except for the default. How do I enable this rewriting? I've tried:

sudo a2enmod rewrite

sudo service apache2 restart

永久链接将保存到/localhost/wordpress中的.htaccess:

The permalinks are saving to the .htaccess in /localhost/wordpress:

# 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

然后我将其复制到根目录/var/www只是为了尝试,它没有任何区别.

and I copy to root /var/www just to try, and it doesn't make any difference.

推荐答案

我也尝试了AllowOverwride All,但是它位于错误的配置文件中,并且损坏了. (将其添加到的正确文件是/etc/apache2/sites-available/default)

I had also tried the AllowOverwride All, but it was in the wrong config file and it broke. (Correct file to add this to is /etc/apache2/sites-available/default) This had the solution for me.

更新为13.10

在新安装中,我可以按上述说明运行它,但是进行了以下更改:

On a new install, I got it working as described above, but with the following changes:

您不必使用/etc/apache2/sites-available/default所描述的内容,而必须使用:

Instead of editing /etc/apache2/sites-available/default as they describe, you must use:

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

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

and add the following after the DocumentRoot /var/www line:

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

如本教程所述,运行sudo a2enmod rewrite

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

Set up the /var/www/.htaccess file, and run:

sudo chmod 664 /var/www/.htaccess

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

然后使用sudo service apache2 restart

这篇关于Wordpress Permalinks永远无法在localhost Ubuntu 12.10上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆