WordPress.org

Forums

[resolved] Pages getting 404 error on localhost site (6 posts)

  1. RoamFree
    Member
    Posted 4 years ago #

    I have a test site that's not on the Internet, so it is at http://localhost/kitchen/

    The About page and a new Shipping page are both giving 404 errors. The URL of About is http://localhost/kitchen/about and I see "about" is in the permalink of the page.

    When I switch to the default Permalink structure, the page is visible. When I choose the second Permalink option (date+title) there are 404s.

    Is there a debug option to ask WP to show what it thinks it's doing? Or what part of the .htaccess is being used?

    I just created it with WP 3.1.3 and the Weaver theme.

  2. ClaytonJames
    Member
    Posted 4 years ago #

    You either have to make .htaccess temporarily writable so that wordpress can update it for you when you change and update the permalinks structure (or paste the changes in the file manually),

    - or your server is not using mod_rewrite,

    - and - or the "AllowOverride all" directive is not being used in your web server config file or virtual hosts container.

    Some reference material: Using Permalinks

  3. RoamFree
    Member
    Posted 4 years ago #

    As I said above, changing the Permalink structure to default does allow the page to be visible. I can see the .htaccess file is being altered, so WordPress does have write access to the file.

    Hmm. When I am viewing the default URL of the page, change the Permalink structure, and then refresh the page with the default URL -- the URL changes to the permalink URL of the page and I get the 404. WP is seeing the request and redirecting to the permalink URL. I am seeing an error in the Apache error log that the 404 happened on http://localhost/kitchen/about

    Apache2 does have mod_rewrite configured and the module is loaded in the Apache server.

    "AllowOverride All" is in all of the directories in the kitchen server site configuration file.

  4. RoamFree
    Member
    Posted 4 years ago #

    Found the problem. The "default" site had a definition for the top-level directory /var/www which had "AllowOverride None".

  5. ClaytonJames
    Member
    Posted 4 years ago #

    When I switch to the default Permalink structure, the page is visible. When I choose the second Permalink option (date+title) there are 404s.

    I'm not sure how to attribute that error to anything other than one of the aforementioned possibilities.

    "AllowOverride All" is in all of the directories

    Not sure I understand that. For reference, take a look in /etc/apache2/sites-enabled/000-default. The basic default site config file looks like this:

    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    If mod_rewrite is functioning, all you should need to do is change it to AllowOverride All and restart apache. I think the same would apply to any other site config files you have added to /sites-enabled/.

    That's a strange one. Maybe someone else will have an idea I'm not thinking of.

  6. ClaytonJames
    Member
    Posted 4 years ago #

    You beat me to it! Glad you got it working.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.