In my local machine, wordpress permalinks not working. After research I found that wordpress not creating .htaccess file.
For this I followed below steps.
-
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.) -
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).
-
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.
-
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
-
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.
- 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.
In terminal type:
sudo gedit /etc/apache2/apache2.conf
Find:
<Directory /var/www/>
And make sure the AllowOverride
directive is set to All
.