9

In my local machine, wordpress permalinks not working. After research I found that wordpress not creating .htaccess file.

For this I followed below steps.

  1. Manually create a ".htaccess" file and save it in your main WordPress directory. (This is the one with the wp-admin, wp-includes, and wp-content folders.)

  2. Go to the Ubuntu terminal and type:

    sudo chown -v :www-data "/FilePathHere/.htaccess"

You should see a line printed saying that the (group) file ownership has been changed to www-data (Apache2).

  1. Give Apache2 write access to the file:

    sudo chmod -v 664 "/FilePathHere/.htaccess"

You should see a line printed saying that the mode of the file has been retained.

  1. Next, we have to allow WordPress to write to the .htaccess file by enabling mod_write in the Apache2 server. Type the following in the terminal:

    sudo a2enmod rewrite

You should see a line printed saying that it is enabling mod rewrite and reminding you to restart the web server

  1. So let's do that. Restart the web server, Apache2, for the changes to take effect by typing:

    sudo /etc/init.d/apache2 restart

We are all done with the command line prompt; you can close the command line window now.

  1. Go into your WordPress admin panel (i.e. http://Domain/wp-admin). Go to the Settings --> Permalinks and select the permalink format of your choice. Hit the "Save Changes" button.

All steps were successful. But even that Permalinks not worked.

Is anything else settings required to work permalinks properly.

13

In terminal type:

sudo gedit /etc/apache2/apache2.conf

Find:

<Directory /var/www/>

And make sure the AllowOverride directive is set to All.

  • You're awesome! – Hunter Leachman Apr 30 '16 at 3:54
  • 3
    sudo service apache2 restart ---- afterward to make the change take effect. – Hunter Leachman Apr 30 '16 at 3:59
  • I had to change AllowOveride to All for /var/www/html – HeatfanJohn Feb 14 '18 at 16:27
0

In order to follow .htaccess redirects, it should be mentioned that Apache's <mod_rewrite> module needs to be enabled.

You can do this from command line on the server using the following commands:

sudo a2enmod rewrite
sudo service apache2 restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.