I run two websites on apache2 on ubuntu, site roots are in /var/www/site1/html and /var/www/site2/html. The url structure of both of them is like this: example.com/index.php/%year%/%monthnum%/%day%/%postname%/

When I change it in wordpress settings, I get the apache2 404 page, not the wordpress 404 template, everywhere except at the frontpage. wp-admin still works, because in its url, there isn't index.php.

mod_rewrite is enabled, I edited the .htaccess file, and also tried adding this:

<IfModule mod_security.c>
SecFilterEngine Off

to the .htaccess file, but the error still persists.

Also, if I set the url settings to plain (example.com/?p=123), it works, there's no index.php in it.

At this point I have no idea what can cause it, I can only think of database, or file permission errors, every idea is welcome.

The settings that I want to work: [1]: https://i.stack.imgur.com/c4gu3.png The settings with which I dont get 404: [2]: https://i.stack.imgur.com/i7K93.png

  • When you go to the front page, what URL do you see? Do you see only example.com or do you see example.com/index.php?
    – t2pe
    Aug 18, 2020 at 14:44
  • I see example.com
    – albiDmtr
    Aug 19, 2020 at 12:30
  • Thanks. If this is still a problem it might be helpful for others here to see what your Permalink settings are. Can I suggest you take a screenshot of the Permalink settings page in your dashboard and add it to your question?
    – t2pe
    Aug 19, 2020 at 12:37
  • Of course, done.
    – albiDmtr
    Aug 19, 2020 at 17:28

1 Answer 1


After making any changes like this, always go to the Dashboard Settings > Permalinks and then click save.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.