fix WordPress permalinks not working (Posts returning 404 error)
In this post we will give you information about fix WordPress permalinks not working (Posts returning 404 error). Hear we will give you detail about fix WordPress permalinks not working (Posts returning 404 error)And how to use it also give you demo for it if it is necessary.
I have spent a couple of hours today trying to fix WordPress broken permalinks for posts and categories and maybe other resources .
All posts returned 404 errors when I changed the format of my links to the beautiful permalinks instead of classic links with the ugly series of id numbers .
Please note that I was using WordPress 4.7 in my local Ubuntu 16 development machine not on a production serverso if this is your case too and you are looking for a solution .Here is what you need to do .
There are many things that can cause your WordPress parmalinks not to work so lets check them one by one .
First you need to have rewrite module enabled .If it not enabled then just open up your terminal and enable itwith :
sudo a2enmod rewrite
If you get
Module rewrite already enabled
That is OK .It only means you have the rewrite module enabled .
Now restart your Apache server with
sudo service apache2 restart
If this doesn’t solve your problem then continue to the next step .
Open .htaccess file and make sure these lines exist
# BEGIN WordPress<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]</IfModule># END WordPress
If not ,then just copy them and save the file then restart Apache with
sudo service apache2 restart
Next you need to open apache2.conf with a text editor
sudo nano /etc/apache2/apache2.conf
Make sure you add sudo then enter your root password .
Look for
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted</Directory>
Then change it to
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted</Directory>
So this is the last thing that helped me save my day .Actually all what we have seen before this last changewas alreay set so the solution was changing AllowOverride from None to All.
I hope this solves your problem too and see you in another post .
Hope this code and post will helped you for implement fix WordPress permalinks not working (Posts returning 404 error). if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs