I already red a lot about this problem, but non of the solutions helped me out. I installed a fresh WordPress on my Apache. After changing the permalink structure from default (www.domain.com/?p=id) to another one, wordpress delivers me an 404 error for each page except the homepage.
I already checked the following:
- mod_rewrite is installed and enabled (checked through phpinfo)
- .htaccess is read- and writable
Here is my default .htaccess
# 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
Using the plugin “Debug this”, I could also find out, that the rewrite rule always deliveres additional index.php? at the beginning. E.g. sitemap_index.xml$
is rewrited as index.php?sitemap=1
What can I do so solve the problem? Default links like www.domain.com/?p=1 but that kills all my SEO.
Edit: After the installation, there was also /index.php/%postname%
written in the custom permalink. But this setting is also returning a 404.
3
Answers
go to your permalink settings and change the permalink structure to “post name” and update your permalink structure. hope it will help.
open this file
chnage all AllowOverride None to AllowOverride All and restart your apache
after that update your permalink structure to post and update it.
path can be different from "/etc/apache2/apache2.conf"
In my Ubuntu server VirtualBox VM this problem was caused by
apache2
not having therewrite
mod enabled. What I did:sudo a2enmod rewrite
to enable mod-rewrite./etc/apache2/apache2.conf
inside the<Directory>
entry for my folder I changedAllowOverride None
AllowOverride FileInfo
sudo service apache2 restart
And now I can permalink. Shoutout to the thousands of people saying just click save settings on your permalink page to fix the 404