• Resolved pizzanakin

    (@pizzanakin)


    I’m working on my first website with WordPress, which will be hosted from my own server machine. The website I’m working on is a remake of a website that is currently being hosted via SquareSpace. This website will eventually be hosted on my own machine in order to cut costs from paying for a host. For this reason, the website I’m working on is currently hosted on just my IP address, as it will be linked up to the actual domain once the website is done. The website I’m rebuilding is this one: https://zeemans-verhalen.nl/

    I’m now in the phase of changing the permalinks for my own website. If possible, I would like these to be identical to the other webpage, to allow all of the links to remain working (they have already been spread around in facebook posts in order to promote this website).

    However, it’s proving to be more of a challenge than anticipated. Simply going into the permalink settings to change the structure to /%category%/%postname%/ causes all of the pages on the website to give 404 errors. On top of that, I seem to then be unable to edit pages using the site builder. After making some changes and pressing the ‘update’ button in the page editor, I get an Invalid JSON Response Error.

    I’ve done some googling into the issue, and I’ve found a number of suggested solutions. Most of these don’t seem to help me though. What I’ve tried so far:

    • Flushing the permalink settings by saving my settings once more
    • Making sure the rewrite module is on in Apache
    • Making sure WordPress can access the .htaccess file
    • Making sure the .htaccess file has the right rewrite rules
    • Disabling my theme and all plugins to see if the issue persists (it does)

    I have discovered I am still able to view pages by using the ?pagename= argument with a valid pagename.

    However, I somehow feel that my issue is different from the other ones I found on Google. I never see any mention of the JSON error in relation to the ‘permalink 404’ issue. But I’m almost 100% certain that these two issues I’m experiencing are related: changing my permalink structure back to ‘plain’ fixes all of the 404 errors, and it also fixes the JSON error when editing pages.

    I’ll share my .htaccess file just to be sure:

    # BEGIN WordPress
    # De richtlijnen (regels) tussen "BEGIN WordPress" en "END WordPress" worden
    # dynamisch gegenereerd en zouden alleen aangepast mogen worden via WordPress filters.
    # Alle wijzigingen aan de richtlijnen tussen deze markeringen worden overschreven.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pizzanakin

    (@pizzanakin)

    (I initially wanted to edit my OP but I can’t seem to find a button for it. If I was supposed to edit the main post instead of posting a reply, please excuse me for that.)

    After doing some more googling, I found this article which talks about changing some settings to Apache2 in order to make the .htaccess file be read: https://www.chalk-ridge.com/permalink-404s-response-is-not-a-valid-json-response/ I tried applying the mentioned changes in the apache2.conf file, sadly without any effect.

    This seems to be the only article which is discussing this issue and also mentioning the JSON error. It also relates it to a website being hosted to a private server, so I am starting to bet the issue is somewhere with the configuration of my system.

    Does anyone know more things I could try out to try and fix this?

    Thread Starter pizzanakin

    (@pizzanakin)

    Okay I think I managed to solve it! The fix that ended up working was putting this code inside the Virtual Host configuration for my website:

    
        <Directory /var/www/zeemansverhalen>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>

    Which was suggested by another article that the previous article I linked to pointed to: https://www.chalk-ridge.com/local-wordpress-install-posts-return-404/

    Hopefully this information will be useful to someone else.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘404 error on permalink and unable to edit pages’ is closed to new replies.