Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Rewrite 404 page?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Rewrite 404 page?

BuyAdsBuyAds Member

Hello Everyone.

It is possible to rewrite the 404 page with a normal page?

What I mean:

I have posted the index.php code into 404.php and works great. The problem are the bots.
They are getting 404 error.
Is there a option to hide this error for the bots? There must be something with headers.

Any idea?

Comments

  • I'm sorry, but with the amount of help threads you ask for, it makes me believe you're not qualified to run a "advertising platform" - I'll ignore that though for this thread.

    1. If you're using nginx you can just rewrite the error page.
    2. cPanel allows you to modify error pages.
    Thanked by 1HyperSpeed
  • TrafficTraffic Member
    edited May 2015

    KwiceroLTD said: you're not qualified to run a "advertising platform"

    He owns MisterHost. That's worse.

    IMHO asking for help is not bad on itself.

    I don't even understand what he needs. Cloaking?

  • Redirect 200 /404.php
    ErrorDocument 404 /404.php
    
    Thanked by 1BuyAds
  • BuyAdsBuyAds Member

    @Traffic said:

    IMHO asking for help is not bad on itself.

    Yeah I own hostgator and ipage also. Is there a problem with it? Help something if you know if not move away.

  • BuyAdsBuyAds Member

    @KwiceroLTD said:
    I'm sorry, but with the amount of help threads you ask for, it makes me believe you're not qualified to run a "advertising platform" - I'll ignore that though for this thread.

    1. If you're using nginx you can just rewrite the error page.
    2. cPanel allows you to modify error pages.

    I have modified it but still wont work. As you can see I have already edited that page.

    @deadbeef thank you but still getting broken page error.

  • TrafficTraffic Member

    BuyAds said: Help something if you know if not move away.

    No thanks. I'm fine here, NOT helping and NOT moving away.

    The forum is not yours.

    And BTW, yes, I can help you, but I'm tired of you, so instead of letting you waste my time, I'll waste yours. Deal?

  • @BuyAds

    Ah, I thought the problem was that the bots was registering a 404 code and you didn't want that.

    If you want to redirect "non existing" pages to the homepage, try this:
    ErrorDocument 404 /index.php

    This tells Apache that the "not found" page is "/index.php".

    Thanked by 1Traffic
  • BuyAdsBuyAds Member

    @deadbeef said:
    BuyAds

    Ah, I thought the problem was that the bots was registering a 404 code and you didn't want that.

    If you want to redirect "non existing" pages to the homepage, try this:
    ErrorDocument 404 /index.php

    This tells Apache that the "not found" page is "/index.php".

    No no.
    Am ok with the 404 page. The user should stay there. Just it send to robots an error that page us broken. All o want is to hide/trick this error that is sent.

  • TrafficTraffic Member
    edited May 2015

  • @BuyAds said:
    Am ok with the 404 page. The user should stay there. Just it send to robots an error that page us broken. All o want is to hide/trick this error that is sent.

    Not sure I understand, sorry. I'll just explain the process.

    When you visit a page, the browser/bot receives 2 things: A status code and content. These are completely separate. You can change both the status cod and the content of each page.

    When a visitor OR bot hits a non existing page, it receives a 404 status code and the error page content.

    If you want the bots to not know they hit a non-existing page, you must change the status code to 200.

  • BuyAdsBuyAds Member
    edited May 2015

    Ok will post the link to check it yourself...

    alcatraz - tours (dot)co(dot)uk

    when you click a link you will show the modified 404 page. You as user do not see any error (also the page title is modified) only the problem is that the robots gets that error. I want to hide that error.

  • TrafficTraffic Member

    Ah, I've understood it at last. He wants to get a Google penalty.

    Sure thing, I can help you with that:

    http://stackoverflow.com/a/18204039

    You have to add this code to the header.php file of the template, at the very top of it.

  • BuyAdsBuyAds Member

    @Traffic said:
    Ah, I've understood it at last. He wants to get a Google penalty.

    Sure thing, I can help you with that:

    http://stackoverflow.com/a/18204039

    You have to add this code to the header.php file of the template, at the very top of it.

    Not working like that. Should I modify wp-blog-header.php with header.php or something else?

    I have added the code in header before the php and after it wont work.

  • TrafficTraffic Member
    edited May 2015

    BuyAds said: Not working like that. Should I modify wp-blog-header.php with header.php or something else?

    You need to add what's right below the "require('../wp-blog-header.php');" line to header.php

    Try both and if neither works, I'll be happy to try it on a sandboxed installation of my own so you can get it as you want.

  • BuyAdsBuyAds Member
    edited May 2015

    There is no such line ("require('../wp-blog-header.php');") in header.php :)

    p.s am on wordpress

  • BuyAdsBuyAds Member
    edited May 2015

    Here is the head of header.php i have modified many things so maybe i have removed that part.

    http://pastebin.com/raw.php?i=juyv3vQF

  • TrafficTraffic Member

    @BuyAds said:
    There is no such line ("require('../wp-blog-header.php');") in header.php :)

    p.s am on wordpress

    No - I mean, you have to use the code starting from that line (in StackOverflow)

    That means the header.php file must start like this (zero white space or blank lines):

    <?php
    
    status_header( 200 );
    //$wp_query->is_404=false; // uncomment removing the leading "//" from this line if necessary

    Or

    <?php
    
    header("HTTP/1.1 200 OK");</pre>
    
  • BuyAdsBuyAds Member

    @Traffic said:
    header("HTTP/1.1 200 OK");

    Nothing works :(

  • TrafficTraffic Member

    https://www.hurl.it/ is what you need to see the headers

  • BuyAdsBuyAds Member

    @Traffic said:
    https://www.hurl.it/ is what you need to see the headers

    Same 404 Not Found :(

  • TrafficTraffic Member

    There's a blank line at the start of every page, also on 404 pages:

    Maybe you added by error a blank line while editing 404.php or header.php or any other file, at the start or at the end?

  • BuyAdsBuyAds Member
    edited May 2015

    No, the blank line is since i have added your code. Will fix it.

    edit: fixed and added your code. Still 404

  • TrafficTraffic Member

    BuyAds said: edit: fixed and added your code. Still 404

    No. I solved your problem.

  • BuyAdsBuyAds Member

    Click a post and copy the link and paste to the site you have posted.

  • TrafficTraffic Member
    edited May 2015

    @BuyAds said:
    Click a post and copy the link and paste to the site you have posted.

    Logout or try on another browser and try to click through your posts. There is something really wrong with your relative paths.

    You asked to remove the 404 header from 404 errors. I solved that. Now learn HTML and basic URL creation and try again.

    Thanked by 1BuyAds
  • BuyAdsBuyAds Member

    outch!!! This one worked but am checking in my site http://website-link-checker.online-domain-tools.com/

    in your site when i select to get head am getting error 404.

    This worked man! Thank you

  • TrafficTraffic Member

    BuyAds said: Thank you

    You're welcome :)

    Thanked by 1BuyAds
Sign In or Register to comment.