• All works fine when my .htaccess looks like this:
    ErrorDocument 404 https://vitorazevedo.com/wp-content/themes/blocks/404.html
    (this is, the custom 404 page works fine if the user types an invalid url)

    But if I use the nice urls permalinks (www.site.com/my-post/) my .htaccess looks like this:
    ErrorDocument 404 https://vitorazevedo.com/wp-content/themes/blocks/404.html
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php
    </IfModule>

    # END WordPress

    and the custom 404 error page doesnt work.
    Any help?

Viewing 5 replies - 1 through 5 (of 5 total)
  • WP 2.0 redirects erroneous pages to the index or to a 404.php file in the current theme, if it exists.

    So you could either make a 404.php page just like the one you’re redirecting to, or have the 404.php page simply forward to your existing error page.

    I think I just discovered that to get erroneous links within the blog to redirect to the main blog page instead of 404.php, all I needed to do is delete 404.php.
    Fred

    in wp 2.0.1
    deleting 404.php just makes the blog address load
    still not getting my custom 404

    I’m having this same problem. my wordpress blog is a small part of my overall website and I use the .htaccess file to redirect some other URLs in addition to the custom 404 page, outside of the WordPress universe. What I’d like is for my changes to the .htacces file to work AND to be able to use the same old clean URLs that I was using before the upgrade. For the record, my .htacces fil looks like this, post 2.0.1 upgrade

    # DirectoryIndex index.php
    # Options FollowSymlinks

    ErrorDocument 404 https://librarian.net/404
    RewriteRule ^index\.rss /wp-rss2.php
    RewriteRule ^index\.rdf /wp-rss2.php
    RewriteRule ^index\.xml /wp-rss2.php
    RewriteRule ^about\.html /about
    RewriteRule ^what\.html /about
    RewriteRule ^faq\.html /faq
    RewriteRule ^talks/index\.html /talk

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

    Suggestions?

    Just on a side note, you can add re-directs to the .htaccess file, incase say, maybe you changed your blog’s location on your server.

    I had that problem before, I had mine at domain.com/blog and then had moved it to: domain.com.

    All the visitors or what not were getting 404s because the blog was moved into the root. I asked Scotty ( https://www.fucoder.com/ ) for some help on this and he told me to do this:

    Add this to the .htaccess file under the: RewriteBase / part of the .htaccess part. Just copy and paste that whole line, well just one of them below and add your own domain name to it. =)

    RewriteRule ^blog/(.*) https://www.vindictivebastard.net/$1 [R,L]

    RewriteRule ^plog/(.*) https://www.vindictivebastard.net/$1 [R,L]

    Now all the old links to either my Plog or Blog url redirects to the domain.com.

    Example here in this post.
    https://www.vindictivebastard.net/brand-new-if-it-wasnt-for-scottys-help.htm/

    or as a Test of it:
    https://www.vindictivebastard.net/blog/brand-new-if-it-wasnt-for-scottys-help.htm/

    I’m also planning on customizing my 404 page, so it basically either redirects ppls to index page, or make the 404 a copy of the index page…. hopefully this will work. =)

    spencerp

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom ‘404 error ‘ not working when nice urls are ON’ is closed to new replies.