Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 07:36 pm EST
Geeklog Forums
How to produce normal 404-pages again?
Status: offline
1000ideen
Forum User
Full Member
Registered: 08/04/03
Posts: 1298
I just noticed that the current GL-version doesn`t have normal 404-pages anymore. It delivers content if a page cannot befound. Thus several pages are not being delisted in Google.
What can I do?
~~~
it concerns static pages and stories
What can I do?
~~~
it concerns static pages and stories
8
15
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
I have a similar issue except I needed to change the id of a staticpage and needed a 301 redirect with the old id. I couldn't get the redirect to function properly on IIS so I hacked the staticpage plugin. I hate hacking plugins as it can make upgrades a pain but here is what I did around line 84 fo the file \public_html\staticpages\index.php
// Hack:
if (strtolower($page) == 'old-page-name') {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.mysite.com/staticpages/index.php?page=new-page-name" );
exit;
}
// ***
One of the Geeklog Core Developers.
Text Formatted Code
// Hack:
if (strtolower($page) == 'old-page-name') {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.mysite.com/staticpages/index.php?page=new-page-name" );
exit;
}
// ***
One of the Geeklog Core Developers.
13
9
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
For stories sure, you would just have to make sure that the reason the story is not available to the user is not a security privilege problem.
For 404 errors with other plugins Geeklog could handle the page but it would have to check with the plugin if the item exists or not.
With my 301 problem Geeklog would need the extra piece of info of which page it should redirect too depending on the page requested. For this reason I was thinking of creating a small plugin for it or adding it to one of the other admin plugins out there.
Tom
One of the Geeklog Core Developers.
For 404 errors with other plugins Geeklog could handle the page but it would have to check with the plugin if the item exists or not.
With my 301 problem Geeklog would need the extra piece of info of which page it should redirect too depending on the page requested. For this reason I was thinking of creating a small plugin for it or adding it to one of the other admin plugins out there.
Tom
One of the Geeklog Core Developers.
11
12
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Stupid me. I had checked this before I hacked the staticpages plugin but I missed the blank page format options.
Anyways for staticpages set the Page Format to Blank page. You then enable Execute Php and then put
header('HTTP/1.0 404 Not Found');
For your 404 file not found error
For a 301 redirect you would put
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: http://www.mysite.com/staticpages/index.php?page=my-new-page" );
One of the Geeklog Core Developers.
Anyways for staticpages set the Page Format to Blank page. You then enable Execute Php and then put
Text Formatted Code
header('HTTP/1.0 404 Not Found');
For your 404 file not found error
For a 301 redirect you would put
Text Formatted Code
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: http://www.mysite.com/staticpages/index.php?page=my-new-page" );
One of the Geeklog Core Developers.
15
11
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
You do not need the hack. I just tried the 404 error code and it worked fine (the browser returned a page not found message instead of Geeklog)
Lets review what you need to do.
1. Create a new staticpage
2. Fill in the following Fields:
Title: 404 Not Found
Page Format: Blank Page
ID: the id of the staticpage you want not found.
Content: header('HTTP/1.0 404 Not Found';
PHP: execute PHP
3. Save the Page
One of the Geeklog Core Developers.
Lets review what you need to do.
1. Create a new staticpage
2. Fill in the following Fields:
Title: 404 Not Found
Page Format: Blank Page
ID: the id of the staticpage you want not found.
Content: header('HTTP/1.0 404 Not Found';
PHP: execute PHP
3. Save the Page
One of the Geeklog Core Developers.
15
14
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
That is probably working then. Google Search Bot would look at the header and see a 404 error.
You can check for sure by entering your url here
http://www.seoconsultants.com/tools/headers
It you want a 404 message that a visitor can read you would have to add in some html.
Tom
One of the Geeklog Core Developers.
You can check for sure by entering your url here
http://www.seoconsultants.com/tools/headers
It you want a 404 message that a visitor can read you would have to add in some html.
Tom
One of the Geeklog Core Developers.
8
9
Quote
All times are EST. The time is now 07:36 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content