I installed WordPress on Ubuntu 22.04 and when I tried to write a post or edit the default post that comes pre-installed I got an error message:
The response is not a valid JSON response
After a lot of googling and also seeing there was no .htaccess file in the root directory, I thought that the reason for this was that in the apache configuration file I had
AllowOverride None. I made a directory specific (to the root directory of my WordPress installation)
AllowOverride All and restarted apache. Now I can edit and make new posts without the error message.
I assumed that when I looked at the contents of the root directory I would see a .htaccess file but there is not one there (I have looked for hidden files). I searched the sub directories and did find one .htaccess file at ./wp-content/plugins/akismet/.htaccess which was created or modified in July. Also Akismet seems to be to do with spam so I thought it was unlikely to be anything to do with the error I had been getting when I tried to create or edit posts.
Although my WordPress installation now appears to be working, I would like to know why the
AllowOverride directive change, which seems to be very much to do with enabling .htaccess files, solved the problem but did not result in a .htaccess appearing in the root directory. I thought I had read that WordPress requires a .htaccess file in the root directory.
I would be very interested in understanding what the situation is in relation to .htaccess files and WordPress and the results I obtained by changing the
AllowOverride All(which is what that sounds like?) doesn't make much sense?
.htaccessfile. You can add one, though, and here's what WordPress recommends you put in your
AllowOverride Alldirective from my config and restarted apache. Now I am able to make and edit posts. It must have been something else I did (or that happened) which solved the problem.