Where’s the rest of the document, there’s no opening HTML or PHP tag..
Please post the complete code from the file in question into a pastebin.
http://wordpress.pastebin.ca/
Then report the link back here, and i’ll take a look for you.
And please do not bump the thread, you actually reduce your chances of getting help by doing that on these forums (volunteers check threads with no replies, you look like you’re getting help by replying to yourself).
Hi,
Reset your permalink from wordpress admin area and add this code in htaccess of your site/blog:
# 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
Now, check with old and new posts of your blog.
Thanks,
Shane G.
Hi Shane… tried that and no luck…
Here is the pastebin of my 404 page
http://wordpress.pastebin.ca/1807373
I have found if I go to my 404 page at http://www.partyeventsunlimited.co.uk/404 it loads correctly
404 template files should be placed inside the theme folder.
http://codex.wordpress.org/Creating_an_Error_404_Page
Well since the file doesn’t contain any form of header there’s no way for the server to know what to do with the file..
There’s no opening HTML tag .. and there’s no PHP at the start of the file, so it’s read as plain text.
See the example given on the link i provided.
I’ve not just uploaded the simpled page and still get a blank page
<html>
<head>
<title>404 Error Page</title>
</head>
<body>
<p>Looks like we have an error</p>
</body>
</html>
If you followed the examples on the link i provided you’d likely have a working 404 page by now..
So again, see the link provided previously please..
I have done so…
I have now got my error page as:
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<h2 class="center">Error 404 - Not Found</h2>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
and my .htaccess (which is in the same location as the index.php in the main root folder) is
# 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
and its still opening in plain text.
I also notice that if I go to http://www.partyeventsunlimited.co.uk/index.php?error=404 I am automatically redirected to http://www.partyeventsunlimited.co.uk/?error=404 which takes me to my index page (nothing like my error page layout except the header and footer).
hmmm getting quite stumped…
Is your custom file in the theme folder and named 404.php?
Get rid of this line..
ErrorDocument 404 /index.php?error=404
Then try an invalid url again.. and see if you get the 404 page..
For all intents and purposes, the two urls(index.php?error=404
and ?error=404
) are actually the same thing anyway.
nope no fix….
Interesting, I changed my permalinks back to the default setting and it appears to load my homepage when any invalid addresses are quested… but when I go to
http://www.partyeventsunlimited.co.uk/404.php
I get
Fatal error: Call to undefined function get_header() in /home/fhlinux142/p/partyeventsunlimited.co.uk/user/htdocs/404.php on line 8
and on line 8 of the 404 is:
get_header(); ?>
which has previously been opened with:
<?php
I changed my permalinks back to the default setting and it appears to load my homepage when any invalid addresses are quested
Yes it would look like your home page because you’re calling your header and footer in the 404 file, but do you see a “Not found” or “Something you’re looking for is not here” message or similar (or whatever text you placed in your 404 template) when it shows the page?
but when I go to
http://www.partyeventsunlimited.co.uk/404.php
*error message etc..
Well yes, calling a wordpress template file from a non-wordpress environment (ie. calling the file directly) it will mean the function are not recognised.
You shouldn’t have the file in the root anyway, like i said before it should be in the theme folder..
partyeventsunlimited.co.uk/404.php - wrong
partyeventsunlimited.co.uk/wp-content/themes/YOURTHEMENAME/404.php - correct
No there is no “not found” as my homepage is quite different to my content pages (which is what the 404 page is replicated to look like). In the homepage there is no-side bar, on all other pages there is. So when I go to the 404 their should be a side bar, but there isnt.
So going to the address you said: partyeventsunlimited.co.uk/PEU2/themes/YOURTHEMENAME/404.php, I get
Fatal error: Call to undefined function get_header() in /home/fhlinux142/p/partyeventsunlimited.co.uk/user/htdocs/wp-content/themes/PEU2/404.php on line 1
my current code is:
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<h2 class="center">Error 404 - Not Found</h2>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
hmmm, any idea?
Btw, thank you for your help, I really really really do appreciate it.