Custom 404 Page
Hi,
I need to redirect 404's to a custom 404 page saved as draft, not published. How do I do this? |
by it's nature, a draft page won't be displayed
|
Alright, tried saving the 404 draft page as complete web page, then uploaded to root of my server.
Typing "http://mysite.com/404.html" at the browser address bar displays the custom 404 page fine, but how do I configure Atahualpa to load this page for site 404's? |
Any resolution on this?
|
there are two ways a 'Not Found can occur
1) a page just doesn't exist 2) you search for something that is not found Case 1 In this case you need a 404.php file in the theme folder. Here is an example for release 3.6.7 HTML Code:
<?php case 2: In this case, edit index.php and look at the bottom where you will see HTML Code:
<h2><?php _e('Not Found','atahualpa'); ?></h2> |
Thanks a lot.
|
So can just the upper code be used the create a custom 404 page and has the lower part then stripped from the index.php?
|
I have tried to make a 404.php but it don't show the styling of the pages.
Normally my pages shows like this http://www.torbenbendixen.dk/om/ But if I type an error page http://www.torbenbendixen.dk/hfdga it doesn't show like the normal pages. What am I doing wrong? I am using version 3.7.6 |
the n'normal' pages are in a post div while your 404 page is not so the styling is not being set. I suggest you look at teh 'normal' page and see teh way the text is wrapped in a <div...>...</div> and add that to your code creating the 404
|
Thank you for this.
I am not sure what you mean by teh? I have searched the forum for "normal page" but can't find something that can help me. |
by 'normal' I was refering to the page you used in the example, the way your pages 'normaly look.
The center area is made up of come divs that have classes and the classes are styled in the theme settings. Your 404 page does not have this div of teh clsasses so the styling is not applied. You can add a new div and style it in the css options or look at the code and see the existing div and classes and wrap your ode in it so the theme styling will apply. |
I see what you mean.
Thank you for this!! I got it working now. |
Quote:
|
First I use this plugin: http://wordpress.org/extend/plugins/useful-404s/
Then I create a file called 404.php, and put this code in the file: <?php /** * for displaying 404 pages (Not Found). **/ ?> <?php list($bfa_ata, $cols, $left_col, $left_col2, $right_col, $right_col2, $bfa_ata['h_blogtitle'], $bfa_ata['h_posttitle']) = bfa_get_options(); get_header(); extract($bfa_ata); ?> <div style="display: block; margin: 0 0 5px 0; padding: 10px 20px; background: white; -moz-border-radius: 10px; -khtml-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; border: solid 1px #E5E5E5;"> <?php useful404s(); ?> </div> <?php get_footer(); ?> I then upload the 404.php file to the theme directory. The code in the <div> should be the same code as your own design. |
Hi juggledad,
Thanks a lot for your help. For better SEO purpose, I want to return a status 404 for soft 404 not found errors. I tried to add redirection code in the else part of index.php but I failed with all the possible types of codes. Added a 404 page also. Could you please help me with this. |
|
Hi,
I added the following code and the page is returning 404. Thanks for this. else /* No posts */ <?php status_header( 404 ) ?> <h2><?php _e('Not Found','atahualpa'); ?></h2> <p><?php _e("Sorry","atahualpa"); ?></p> I was actually trying to return the http status 404 and also redirect it to 404.php page. I could not do it. |
That will return a 404 - check your log - AND it will run a 404.php if you have one in the atahualpa folder. However it will show inside the atahualpa page you are building.
one other thing - a search for something that is not found will NOT generate a 404 if you create a link to a page that doesnot exist, that WILL create a 404 so a search for 'this-text-does-not-exist' will (probably) just return a not found (The text in index.php) entering a url of http://yourdomani.com/this-text-does-not-exist should result in a 404 and what ever you have in your 404.php or the text in index.php. if you want the 404 to redirect to a completly different page without your Atahualpa settings, you will probably need to add a 404 redirect in your htaccess file (if you don't know how - do a google search) |
All times are GMT -6. The time now is 05:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.