Support » Localhost Installs » Pages not showing up (error 404 instead)

  • Resolved youknowmenot

    (@youknowmenot)


    My pages are present inside the admin dashboard, but on the front-end error 404 shows up. I’m working on win7/xampp, using my custom theme, I have only 2 plugins (Pods and Classic Editor). Tried deactivating them one by one, while experimenting with settings->permalink section, clearing cache after every attempt to ensure that is not the problem. Deleted htaccess, WP creates new one and it looks ok, pasting the code here:

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <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

    My WP is in my main directory, so htaccess should be correct. I then went to check the httpd.conf of Apache to see if this is commented:

    LoadModule rewrite_module modules/mod_rewrite.so

    It was not commented so it should be working. Then I went to change this piece of code in the httpd.conf:

    #
    # Deny access to the entirety of your server's filesystem. You must
    # explicitly permit access to web content directories in other 
    # <Directory> blocks below.
    #
    <Directory />
        AllowOverride none
        Require all denied
    </Directory>

    I changed it to AllowOverride Yes and Require all granted – still did not work. Changed back and went to this piece of code below it:

    DocumentRoot "E:/Server/htdocs"
    <Directory "E:/Server/htdocs">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
    </Directory>

    I have limited knowledge and do not understand how I should go about fixing my issue. Everything else is working perfectly. When I update my permalinks, they lead to their correct URLs, but the pages don’t open. I read a lot of support threads before opening this one and nothing helped. Some guy said he fixed his issue by adding “options +FollowSymLinks” to his htaccess. I tried to add this to in the final line and it still didn’t work. Starting to lose my mind, any help appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Dion

    (@diondesigns)

    You must restart Apache after any changes to httpd.conf in order for those changes to take effect.

    You should check the Apache error log; your issue may be documented there.

    Since you can access the WordPress backend, go to Settings->Permalinks and change the permalinks to “Plain”. Does the frontend now display correctly? If so, then your issue is with the .htaccess file — either Apache cannot read it, or there is an issue with the file itself.

    Thread Starter youknowmenot

    (@youknowmenot)

    Appreciate telling me I have to restart xampp for the updated .conf to take effect, didn’t know that. Sadly, I made several attempts at tweaking the .conf and it’s still not working. Yes, I have switched to Plain after every restart to no avail as well. 🙁 I can access everything on my website except my pages. Even my search is working properly. I tried making new pages, changing the names of the old ones, creating page templates to assign to them – nothing works.

    Edit: I just want to add that permalinks are working. If I switch to plain then it changes my links to plain format, if I switch to custom one, it transforms them correctly. So the problem is with htaccess I guess but I cannot figure out whats not working. Sorry if I was not clear enough the first time.

    • This reply was modified 1 month, 2 weeks ago by youknowmenot.
    Thread Starter youknowmenot

    (@youknowmenot)

    I just checked and my .htaccess went blank, with only the comments remaining

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    
    # END WordPress

    I’m stumped. I assume plugins can cause this, but there is 0 help on the internet, I checked the codex, copied the htaccess (same as the one I’ve used above) and something causes it to delete itself and go blank again. I disabled my plugins one by one, and still the same.

    Edit: Turns out htaccess becomes empty whenever I revert to “plain” permalink format. When I put custom, it “pops” back. With or without plugins. I don’t know if this is normal…

    • This reply was modified 1 month, 2 weeks ago by youknowmenot.
    Thread Starter youknowmenot

    (@youknowmenot)

    Closing the thread and marking as resolved: after changing to another theme, I saw it works fine and figured the problem lies somewhere in my custom theme’s functions. Found the bug and fixed it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.