Support » Localhost Installs » how to set permalinks back to Post name and avoid 404 Not Found error?

  • Hi all!

    How do I avoid “404 Not Found” error after having set my permalinks back to “Post name” after having temporarily set them to Plain/Default?

    How it was, was I didn’t touch permalinks since the way a fresh self-hosted WP v.4.6.1 install.

    What I did was set the permalinks to “Plain” (a.k.a. ugly) and clicked save.

    Now I want permalinks to “Post name” so I chose that and clicked save.

    Now the symptom happens. The symptom is as described above, whenever I browse to a Page on the website, the url looks pretty (uses the post name (slug)), however my browser is showing a 404 Not Found page.

    Running on Apache on localhost. (Ubuntu 12 with LAMP stack installed via tasksel command)

    What I’ve done:
    I googled and some people said to make sure .htaccess is writeable. I did so, and made .htaccess 777 temporarily. Then I toggled the permalinks to Plain again, then back to “Post name”. This test showed me that WordPress did write fine to .htaccess because the .htaccess file contents changed when I toggled the permalinks.

    After toggling permalinks, I opened a fresh In Private browser window(, to make sure the browser cache wasn’t a facton). Symptom persisted.

    Thanks for reading — let me know what other info. I can provide or what I can try next! What’s a good next step?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Update:

    *sobs with joy*

    I found a fix. So happy!

    In short, the fix for me was to go into the WordPress admin dashboard, go to:

    “Settings” > “Permalinks” > “Common settings”, and set the radio button to “Custom Structure”

    , and paste into the text box:

    /index.php/%year%/%monthnum%/%day%/%postname%/

    , and click the Save button.

    Now, no longer getting 404 error. Symptom resolved!

    The postmortem on this (postmortem meaning looking back and seeing what caused it, and how to prevent it again), is that I found that a clean new install of WordPress v.4.6.1 installs by default with “Custom Structure” set exactly in this way.

    How did I find this out? I went ahead and did a clean install of WordPress, and looked under permalinks settings to see it. When I saw that was the case, I suspected all I’d have to do was set it back to that exact custom structure. And indeed that fixed it.

    Thanks for reading — I think having an audience helped me to dig deeper. Hopefully this can help someone in the future with the exact same question.

    infoholico

    (@infoholico)

    Thanks

    kleberrpedrosa

    (@kleberrpedrosa)

    It worked for me too

    bodywise

    (@bodywise)

    Unbelievable. It worked. I have only been struggling with this for a week. All the other fixes did not work. This fix worked. thank you! I still think this is a bug in WP that needs to be corrected.

    Quite frankly this is a bug that is not being recognized. It is universal and reproducible. It needs to be fixed without all these workarounds.

    Finally! Its works for me. Thank You so much!

    Genius! thanks!

    Is best that in your apache2.conf write

    <Directory /var/www/html/yourDirectory>
        AllowOverride All
    </Directory>

    restart your apache and ready. Simple

    • This reply was modified 9 months, 3 weeks ago by  ruben13.

    Is best that in your apache2.conf write

    <Directory /var/www/html/yourDirectory>
    AllowOverride All
    </Directory>
    restart your apache and ready. Simple

    Just remember that allowing open (‘All’) Override rather than using the ‘Options’ switch and being a bit more discerning with Symlinks allows .htaccess sanctioned files to overwrite a whole bunch of default Apache2 directives designed to prevent malicious code injection/execution. I say this after losing my last WP site to this vuln. Apparently its included ‘detected’ in some broad Metasploit/Burp scans as a medium level vuln too. Just sayin’!

    It worked for me too.

    Thanks!!

    Thank you for posting your solution even though no-one had replied to your original question, that was really great.

    Worked for me! I hadn’t a clue what had gone wrong. Seems like a bug methinks.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘how to set permalinks back to Post name and avoid 404 Not Found error?’ is closed to new replies.