Wordpress Permalink( shows 404) not working in LAMP stack ubuntu 20.04
Sahil kashyap
Posted on May 16, 2021
Assuming
- php7.4 is running(php8.0 showed way to many error to run wordpress)
- you've placed your wordpress project in /var/www/html/mywordpress and given it file permission 755(basically read & write in folder/files & subfolder/files)
- setuped the db connection in wp-config.php properly
- went to url: "localhost/mywordpress/wp-admin" and allowed the permalinks
- an automatic .htaccess would have been created or wordpress UI will give you the .htaccess file content. copy it and paste it in "mywordpress" folder
before rewrite
sudo a2enmod rewrite
make sure its enabled
Here's the solution
go to this file
/etc/apache2/apache2.confopen it in sudo nano or simply drop the file in vscode
Go to line "159"
and update this line
<Directory />
Options FollowSymLinks
AllowOverride none
Require all denied
</Directory>
to
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
and
on line 170
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride none
Require all granted
</Directory>
to
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
now save the file
and in cmd run this
sudo service apache2 restart
this should fix it
💖 💪 🙅 🚩
Sahil kashyap
Posted on May 16, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.