Wordpress Permalinks never work on localhost Ubuntu 12.10

十年热恋 提交于 2019-12-22 07:00:10

问题


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

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

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


回答1:


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.

Update for 13.10

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

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

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

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

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

As the tutorial describes, run sudo a2enmod rewrite

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

sudo chmod 664 /var/www/.htaccess

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

And restart with sudo service apache2 restart



来源:https://stackoverflow.com/questions/14825980/wordpress-permalinks-never-work-on-localhost-ubuntu-12-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!