WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Local Installation Permalink Problem - 404 error (4 posts)

  1. eryanv
    Member
    Posted 4 years ago #

    No matter what I read, I can't seem to get Permalinks working on any local installation of WordPress. This is a Ubuntu/Apache2 setup.
    Here's what I know:

    • Set the Permalink to Month and Name, the .htaccess file is getting a new timestamp when the Permalink structure changes.
    • mod_rewrite is enabled according to phpinfo();
    • Contents of my .htaccess file (located at ~eryanv/.public_html/i4k/)
      # BEGIN WordPress
      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /~eryanv/i4k/
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /~eryanv/i4k/index.php [L]
      </IfModule>
      
      # END WordPress
    • I've also tried adding Option +FollowSymLinks and AllowOverride All to the .htaccess file, outside and inside the IfModule block.
    • Apache's access log for a request looks like: 127.0.0.1 - - [29/Dec/2009:01:59:03 -0600] "GET /~eryanv/i4k/2009/12/welcome-4/ HTTP/1.1" 404 278 "http://localhost/~eryanv/i4k/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.16) Gecko/2009121601 Ubuntu/9.04 (jaunty) Firefox/3.0.16"
    • Apache's error log for a request looks like: [Tue Dec 29 01:59:03 2009] [error] [client 127.0.0.1] File does not exist: /home/eryanv/.public_html/i4k/2009, referer: http://localhost/~eryanv/i4k/
    • The 404 page generated is a webserver 404 page, rather than a prettified wordpress 404 page.`The requested URL /~eryanv/i4k/2009/12/welcome-4/ was not found on this server.
      Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.4 with Suhosin-Patch Server at localhost Port 80`

    My not very expert eye thinks this might be an issue of Apache not using the rewrite rules in the .htaccess file, but I'm not really sure about that. Any suggestions on how to get permalinks functional?

  2. Shane G.
    Member
    Posted 4 years ago #

    Hi,

    Set your desired permalink and add this code in htaccess:

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Thanks,

    Shane G.

  3. eryanv
    Member
    Posted 4 years ago #

    Altering the RewriteBase and RewriteRule didn't change anything, and I'm not sure how changing the 404 ErrorDocument would help fix the underlying problem (which by the way, it still shows the regular webserver 404 page).

  4. eryanv
    Member
    Posted 4 years ago #

    After a bit more investigation I figured it out. There's no need to deviate from the provided .htaccess file. I needed to go into the site configuration in /etc/apache2/sites-enabled and alter the root Directory configuration to read:

    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>

    Reading through the mod_rewrite documentation it seems like AllowOverride FileInfo should be sufficient to cause the rewrite rules to function properly.

Topic Closed

This topic has been closed to new replies.

About this Topic