• Resolved mrminit

    (@mrminit)


    Hello,

    I’ve just set up WordPress on my personal Debian server, and now I’m trying to configure permalinks to this format:
    /%category%/%postname%

    This is not working. I’ve followed those instructions as well as I can, but it’s still not working. My /etc/apache2/httpd.conf looks like this:

    <Directory /var/www>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    I’m pretty sure the “mod_rewrite”-module is active, because when I had the following line on top of httpd.conf, init.d told me it already had been started.
    LoadModule rewrite_module modules/mod_rewrite.so

    Just for your information; the method without mod_rewrite worked out well. The one for structures like index.php/%category%/%postname%. Anyway I belive the rewrite-module is running.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Are you seeing a WordPress “Not found” page or the server default “Not found” page?

    Look in the .htaccess file in WordPress’s directory to see if the mod_rewrite rules were added — or did you add them yourself?

    Thread Starter mrminit

    (@mrminit)

    I see the server default “Not Found” page, like this:

    Not Found
    
    The requested URL /uncategorized/hello-world was not found on this server.
    Apache/2.2.3 (Debian) PHP/5.2.0-8+etch9 Server at xxx.xxx.xxx.xxx Port 80

    Yes, I chmod’ed the .htaccess-file so WordPress could edit the file. The file is now containing this:

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

    Thank you very much for help. ??

    To see if mod_rewrite is active, try commenting out the IfModule lines, like

    #<IfModule mod_rewrite.c>
    #</IfModule>

    If the mod_rewrite module is NOT active, then you’ll get a server error.

    Is this on a live/public server?

    Thread Starter mrminit

    (@mrminit)

    I’m not getting a server error after doing this (where was I supposed to see anything, by the way?), except from the “Not Found”-error mentioned above.

    This is my personal server which I got full root access to. It’s running Debian Etch, Apache2 and PHP5 – if that matters. ??

    Actually, ignore my last post, there’s a better way:

    Create a test directory, create an .htaccess file inside with this line:

    RewriteEngine On

    Then open that directory in your web browser.

    If the mod_rewrite module is NOT active, then you’ll get a server error — you can check your error log to see what it is.

    Thread Starter mrminit

    (@mrminit)

    This seems to work, so I can’t understand anything but the fact that the mod_rewrite module is active.

    Suggestions?

    Well, let’s see…

    ? Did you restart Apache after you edited httpd.conf?
    ? Have you confirmed that *any* directive in the /var/www/.htaccess file has some effect (meaning the .htaccess file is being read)?
    ? Double check that the # BEGIN WordPress rules are in the .htaccess file in the same directory with WordPress’s index.php file, and that directory is your “Blog Address” (in General Options)

    You could maybe test the rewrite engine by putting these at the start of your /var/www/.htaccess file, before the WordPress rules:

    RewriteEngine On
    RewriteBase /
    RewriteRule test /?ok [redirect,last]

    Then open URL /test in your browser — you should see /?ok in your location bar.

    Thread Starter mrminit

    (@mrminit)

    1) Yes, I’ve tried to restart Apache after every move I’ve made, without any affection. My httpd.conf still looks like this:

    <Directory /var/www>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    (Can you please double check if there is anything missing/typos/etc? I’ve edited this file myself. Or more correctly, pasted it from somewhere on Google.)

    2) No, actually not. Nothing of what you’ve told me to do has worked. Is this a symptom of a not working rewrite engine? As I mentioned in a previous post, I get an error if adding LoadModule rewrite_module modules/mod_rewrite.so to the httpd.conf file. The error message is this:

    everly:/var/www# /etc/init.d/apache2 restart
    Forcing reload of web server (apache2)...[Tue Jan 08 21:09:07 2008] [warn] module rewrite_module is already loaded, skipping
     waiting [Tue Jan 08 21:09:09 2008] [warn] module rewrite_module is already loaded, skipping
    .
    everly:/var/www#

    3) As you see in my httpd.conf shown above /var/www/ is specified. This is also where I keep my WordPress-installation, so yes, WordPress’ index.php is in the right directory. Because I have not bought a new domain yet, the “Blog Address” in General Options only shows my IP (with the https://). I guess there is no need for a domain to get this working? I’m most likely to buy it this week, though. I’m also sure the .htaccess file is located correctly (in /var/www/ – right?).

    Your last suggestion also failed. Nothing but the same error message were the output.

    Not Found
    
    The requested URL /test was not found on this server.

    Thank you so much for your time! I hope I can get this working soon.

    The directives in your <Directory /var/www> section look right.

    Try putting this at the top of your /var/www/.htaccess file (all on 1 line):

    ErrorDocument 404 "Not found (this is your .htaccess file)

    then load one of WordPress’s permalinks, or any non-existing URL.

    If you see the custom message (this is your .htaccess file), it means the .htaccess file is being read and applied.

    Thread Starter mrminit

    (@mrminit)

    Not even this is working. So, my .htaccess-file is not being read?

    everly:~# a2enmod rewrite
    This module is already enabled!
    everly:~#

    How could this be?

    > Not even this is working.

    So you still see the default server 404 page?

    Ok, put this line inside your <Directory /var/www> section in httpd.conf:

    ErrorDocument 404 "Not found (httpd.conf Directory /var/www)

    Save, restart Apache. Load a non-existent URL (like /404test) in your browser. You should see the message “”Not found (httpd.conf Directory /var/www)” instead of the default server 404 page, I hope.

    Thread Starter mrminit

    (@mrminit)

    > So you still see the default server 404 page?
    Yep, but after doing the ErrorDocument-thingy directly in httpd.conf it works just like you hope. So I imagine it only has problems to read the .htaccess-files?

    EDIT: The apache2.conf says AccessFileName .htaccess, so that should not be the problem.

    That’s good news. Do you see AllowOverride None anywhere in your config files?

    Thread Starter mrminit

    (@mrminit)

    God yeah!

    Another <Directory /var/www/> was hidden in /etc/apache2/sites-enabled/000-default! I just #-ed that single line, and then the permalinks worked like a charm. Should I comment everything of it? It looks like this right now:

    <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
    #               AllowOverride None
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
                    # RedirectMatch ^/$ /apache2-default/
            </Directory>

    Thank you very much for your time and effort!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘“Pretty” permalinks problem; “Not Found”’ is closed to new replies.