• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

301 Redirect to Custom 404page? AAAHHHH!

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › 301 Redirect to Custom 404page? AAAHHHH!

This topic is: not resolved

Tagged: 301, 404, custom, htaccess

  • This topic has 16 replies, 3 voices, and was last updated 11 years, 5 months ago by Summer.
Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • December 3, 2013 at 8:44 am #76795
    stepheniryna
    Member

    Ideally I won't ever have 404s. But just in case, I created a page and titled it "404page". Added something like this in the htaccess:

    ErrorDocument 404 /404page.php

    This was supposed to circumvent the 404.php template and take people to "/404page" instead. It worked great.

    A few months later I am trying to do the same thing on another site. It doesn't work. Then I go to the other site, and it no longer works there. All 423 articles I found on Google either talk about customizing a php (which I am unable to do in a way that looks like my other site pages), OR they include an htaccess line like the one above.

    Does anybody here know how to set this up?

    http://smallbusinessyou.com
    December 4, 2013 at 1:01 am #76906
    nutsandbolts
    Member

    Have you considered the Genesis 404 Page plugin? Much easier than all the redirects in my opinion.


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    December 4, 2013 at 3:25 am #76920
    stepheniryna
    Member

    I'm not sure what you mean by "all the redirects". It was only one line of code in the htaccess; it takes all 404 errors to the custom 404 page. Or, at least, it did.

    Another plugin... Maybe I will have a look at it. I'm just amazed that the answer is so elusive now.

    December 4, 2013 at 11:31 am #76988
    Summer
    Member

    Have you tried making your .htaccess redirect a fully qualified URL?

    ErrorDocument 404 http://smallbusinessyou.com/404page.php


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    December 4, 2013 at 11:32 am #76990
    Summer
    Member

    Apparently, my replies are being eaten by the forums again 🙂

    Have you tried using a fully qualified URL for the redirect in your .htaccess file?


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    December 4, 2013 at 12:50 pm #77009
    stepheniryna
    Member

    Thanks for your reply Summer.

    Yes I have tried every url form imaginable (with .php and without, with trailing slask and without, with www and without). Something changed in Genesis and all of the 404 ideas I find (except plugin) are no longer working.

    I use Dynamik, and they make it easy to add templates in the child theme. So I copied the genesis 404 template and changed just the title (to experiment). But nothing changed on actual 404 page.

    Also I just found the code I used before. It was actually a modified 404 page template.

    <?php
    $URL= get_bloginfo('url');
    header("Location: http://www.mysitename.com/404page/");
    ?>

    I assume somebody who knows this stuff can see how this could work. Hopefully that same person can tell me why it does not work now 🙂

    December 4, 2013 at 3:27 pm #77044
    Summer
    Member

    That code tells me you had static page called "404page" inside WordPress. So theoretically, your /404page.php directive shouldn't have worked, but I seem to recall something in WordPress where near matches would pull up a page... I ran into that problem with pages that should have returned 404s calling up pages with partial words in them, but they don't do that anymore... I never dug into that to see why, so I don't know for sure if that was a WordPress change, but I remember something along those lines changing between 3.5 and 3.6.

    So using that exact URL in your .htaccess file as you have it in that snippet should also have worked in your .htaccess file, IF that static page still exists at that URL.

    Is the URL you're working on the one in your first post? Because that page does come up, but the text on it is unfinished. So if you put that URL in your .htaccess file, and test it by going to a URL on your site you know doesn't exist, that 404page URL should come up for you.


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    December 4, 2013 at 3:57 pm #77052
    stepheniryna
    Member

    Yes, that is a page called "404page" inside wordpress. And yes, that url is the one I'm working on.

    That code worked great when I got it, and it was only a couple of months ago. I have seen the same code on other sites. Here's one:

    http://www.wphike.com/170/how-to-create-custom-404-error-page-in-genesis-framework/

    That static page still exists, but the htaccess line doesn't change anything. And I have seen that line of code (htaccess) all over the web. Not sure why it's not working. I've been testing like you said; just doesn't work.

    For now I just took it out of there so that I don't mess something up.

    December 4, 2013 at 6:12 pm #77074
    Summer
    Member

    Well, when I try to access that page now, I get this error:

    Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in smallbusinessyou.com/wp-content/uploads/dynamik-gen/theme/custom-functions.php on line 50

    And if I go to a URL that generates a 404 error, a 404 page does come up. Which page are you trying to have be your 404 page, and what error were you getting before?


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    December 4, 2013 at 6:13 pm #77075
    Summer
    Member

    Well, when I try to access that page now, I get this error:

    Parse error: syntax error, unexpected '(', expecting T_VARIABLE or '$' in smallbusinessyou.com/wp-content/uploads/dynamik-gen/theme/custom-functions.php on line 50

    And if I go to a URL that generates a 404 error, a 404 page does come up. Which page are you trying to have be your 404 page, and what error were you getting before?


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    December 4, 2013 at 6:14 pm #77076
    Summer
    Member

    FFS, why is the forum eating every post I submit that has code quoted in it?

    Anyway, your custom 404page is generating a PHP syntax error, while a regular not found destination is pulling up a generic 404 page.

    What is it exactly that isn't working?


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    December 4, 2013 at 6:55 pm #77085
    stepheniryna
    Member

    uh... (glazed look in eyes), I don't know what you just said.

    All I want is:

    1) I type in mysite.com/wrong-url
    2) some little gnome in my computer takes me to mysite.com/404page (the one I created in wordpress)

    December 4, 2013 at 9:56 pm #77124
    Summer
    Member

    I was curious about the PHP syntax error, but that seems to be fixed now.

    So, the destination you want all error pages to use is http://smallbusinessyou.com/404page/ right?

    Right now, if I use a bogus URL to that domain, it comes up with a default 404 page, which means that another template or a default template is in the mix somewhere.

    There are several ways to change this.

    First, make sure there is no 404.php template in your theme folder, and that any 404 plugins or other 404 redirects are disabled.

    Then, make sure the ErrorDocument directive in htaccess uses the complete URL, http://smallbusinessyou.com/404page/

    or... take the content from that 404page page, and make it the content of your 404.php template, and remove the ErrorDocument directive from your htaccess file and unpublish that page.


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    December 4, 2013 at 9:58 pm #77125
    Summer
    Member

    I was curious about the PHP syntax error, but that seems to be fixed now.

    So, the destination you want all error pages to use is http://mysite.com/404page/ right? (for some reason these forums are not posting my posts using your smallbusiness URL)

    Right now, if I use a bogus URL to that domain, it comes up with a default 404 page, which means that another template or a default template is in the mix somewhere.

    There are several ways to change this.

    First, make sure there is no 404.php template in your theme folder, and that any 404 plugins or other 404 redirects are disabled.

    Then, make sure the ErrorDocument directive in htaccess uses the complete URL, http://mysite.com/404page/

    or... take the content from that 404page page, and make it the content of your 404.php template, and remove the ErrorDocument directive from your htaccess file and unpublish that page.


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    December 4, 2013 at 10:32 pm #77130
    stepheniryna
    Member

    Figured out solution. View source of "/404page". Copy all. Open Dynamik custom > templates. Add new. Title "404" (this is a php page). Select "wordpress page" instead of "page template". Paste all. Save. Done

    Now all 404 errors show the exact mirror of my "/404page" in wordpress.

    No plugin necessary.

    Thanks everybody for the attempts to help.

    Now if I could only figure out this smooth scrolling to anchors... I'll post if not.

    December 5, 2013 at 3:12 pm #77284
    stepheniryna
    Member

    Well, the 404 template is Genesis, but not in Dynamik.

    Are you advising to delete the Genesis 404 template?

    Or if I copy and paste all code to 404.php, will everything update there if I make a change on my site like a sidebar widget? Or does it just stay the way it was when I pasted it in?

    December 5, 2013 at 6:34 pm #77303
    Summer
    Member

    If you paste your content into the 404.php in the theme folder (properly wrapped in php of course), and it uses the same sidebars as the other templates/rest of your site (meaning you don't remove them like on a landing page), then yes it should be the same.

    From my understanding, Dynamik should generate what you need, and if it's working, it should always work unless you remove Dynamik from your site. If that's working now, you should be good to go.

    This is one of those cases where there are several solutions, and depending on what you need, there isn't one solution that's better or more "right" than another.


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

  • Author
    Posts
Viewing 17 posts - 1 through 17 (of 17 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble