skip to Main Content

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


  1. go to your permalink settings and change the permalink structure to “post name” and update your permalink structure. hope it will help.

    Login or Signup to reply.
  2. open this file

    /etc/apache2/apache2.conf
    

    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"

    Login or Signup to reply.
  3. In my Ubuntu server VirtualBox VM this problem was caused by apache2 not having the rewrite mod enabled. What I did:

    1. sudo a2enmod rewrite to enable mod-rewrite.
    2. In /etc/apache2/apache2.conf inside the <Directory> entry for my folder I changed
    • This: AllowOverride None
    • To this:
      AllowOverride FileInfo
    1. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search