Support » Fixing WordPress » Permalinks not working without index.php in the url

  • Resolved jjacobsen

    (@jjacobsen)


    I’ve seen similar posts but no solution. If this hasn’t been fixed, perhaps this will help?

    If my link looks like this then it will work:
    /index.php/2006/01/13/hello-world

    If I change the permalink to eliminate index.php then I get a WordPress 404 error:
    /2006/01/13/hello-world

    [and yes, htaccess is redirecting ok]

    I found a link to what was supposed to be a fixed copy of classes.php, but it appears that the problem is still there in the version that I downloaded.

    I put some debug code into classes.php and in the function parse_request() I find the following situation right before the comment that says “// The requested permalink is in $pathinfo for path info requests and in $req_uri for other requests”

    Using index.php $pathinfo = 2006/01.. $requri = index.php
    Without index.php $pathinfo = (blank) $requri = 2006/01..

    A few lines later in the code, the value of $request in both cases is 2006/01/13/hello-world so it would seem that they both should have the same result.

    However, when using index.php I notice a few lines later that the if statement with the comment “// If the requesting file is the anchor of the match, prepend it…” is executed and $request_match now contains the value index.php/2006/01.. while in the non-working case it remains the same as $request.

    (By the way, why is the if statement in the while loop? It executes multiple times)

    In any event, if $request_match contains “index.php” the permalink works and without it the 404 comes up.

Viewing 9 replies - 1 through 9 (of 9 total)
  • billdennis5

    (@billdennis5)

    I am havng the same probem at “http://peoriapundit.com/blogopeoria“!

    My permalinks go to a 500 server error. But if I manualy insert “index.php” before the “2006/01” in the URL in the address bar.

    I’ve also found it impossible to get into my admin pannel. I tried adding the “index.php” before “/wp-admin/”, but it just shows the main page.

    This obviously isn’t a matter of the DNS not being resolved.

    billdennis5

    (@billdennis5)

    This is all my .htaccess says:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php
    </IfModule>

    # END WordPress

    billdennis5

    (@billdennis5)

    Nevermind: I solved the problem by dumping 2.0 and installing 1.5.2.

    IAMalik

    (@iamalik)

    If you go to options in the control panel, and change the permalink structure, it should work.

    jjacobsen

    (@jjacobsen)

    Yes, it works fine if I use:
    /index.php/%year%/%monthnum%/%day%/%postname%/

    But the structure I want to use doesn’t work:
    /%year%/%monthnum%/%day%/%postname%/

    IAMalik

    (@iamalik)

    change the permalink structure to default, then change it back

    jjacobsen

    (@jjacobsen)

    No luck. I think there is a problem in the version of classes.php that I have. If it has been fixed perhaps I just need to find the latest update.

    I guess I’ll just use index.php as part of the URL for now and not worry about it.

    semperfidelis

    (@semperfidelis)

    jjacobsen

    (@jjacobsen)

    Problem solved!

    What I discovered is that when I change the permalink structure the old rewrite rules are still cached in the database and don’t get updated.

    There is a record in the wp_options table with an index field called “option_name”. I found the record with the option_name of “rewrite_rules” and set the option_value blank. That forced it to generate the new values and it started working immediately.

    I don’t know why it didn’t update when I change things in the control panel, but at least my problem is solved and it is working now.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Permalinks not working without index.php in the url’ is closed to new replies.