error 404 - page not found wordpress code example
Example 1: wordpress inner page not found error
NOTE : If you got this error after installing wordpress on a newly configured
ubuntu server
----------------------------------
1. sudo a2enmod rewrite
2. Add AllowOverride All in virtual host
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
3. restart apache
Example 2: wordpress main page is showing but other pages show page not found
There can be two solutions for this
1. Modify .Htaccess with the code given below:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
#If project is inside the subfolder
#RewriteRule . /PATH_TO_SUB_FOLDER/index.php [L]
# End WordPress
2. Correct The Permalinks Structure
If you can access you admin panel, Then
Step 1. Inside Settings and then on Permalinks
(Take a look at the current setting. If you’re using a custom permalink
structure, copy-save it somewhere.)
Step 2. Select Default.
Step 3. Click on Save Settings.
If not then inside your database :
options table => Search `permalink_structure` and set it to /%postname%/
reference:
https://www.pickaweb.co.uk/kb/wordpress-fix-404-not-found-error/#:~:text=You%20can%20also%20fix%20the,permalinks%20of%20your%20WordPress%20site.&text=Log%20into%20WordPress%20Dashboard.,copy%2Dsave%20it%20somewhere.)