404 Page / Missing.html Customization

software development

#1

I see I’ve got alternatives to custom error pages. Either using missing.html or changing .htaccess file.

I simply want a page to display as missing.html; but within this page I would like to include the wrong URL the user entered or linked from. In the standard 404 error page is usually states:

Not Found

The requested URL /xxxxxxx/ was not found on this server.

How can I drop this phrase into my custom 404 missing.html page?

Frankly, Ideally what I’d like to do is have that URL automatically entered into a search box on my WordPress website. I know that’d be tricky but what’s happened is I migrated my site from the old blog system “Radio” to word press. I’ve got all my posts, but within some of those posts I refer back to pages. It’s impossible to identify all those pages with self-referrals AND identify the new Word Press URL for that page.

So in summary I’d like

  1. how do i include the mis-directed URL in my missing.html page

nice to know:

  1. Can i have that mis-directed URL auto-fill in a Word Press Search Box on that Missing HTML page?

Thanks


#2

The documentation is right here.

Apache > HTTP Server > Documentation > Version 2.0 > Modules > mod_include

:cool: openvein.org -//-


#3

Hey thanks… but that looks a little over my head… !!!

I imagine this points to using the “field” describing the BROKEN LINKED URL:

Your browser sent a request that this server could not understand:

] in my missing.html file?

if I dig deeper will this show me how to auto-fill the search form?

thanks


#4

.htaccess
----------ErrorDocument 404 /missing.shtml
missing.shtml
--------------[code]

Not found [/code] :cool: [url=http://openvein.org/]openvein.org[/url] -//-

#5

YOU LEGEND… wow. thanks

okay. so sorry to be a pain, but there’s something i can’t figure out here.

I put the address for the form submission to my search “page”. And that works. But, when I load a missing page, the variable that’s in the search box is this:

here’s a bad link:

http://www.blog.digitaltavern.com/2003/05/06/so-what-why-not-sure-think-again-and-again/

But if you replace that text in the search form field and hit submit, it resolves to a results page on my site… now to just get the right text which is from the URL to fill that form… did I do something wrong?


#6

Yes. Only certain files are parsed for the SSI elements. Again in the documentation the default setting is files that end in .shtml

  1. Make sure the filename is missing.shtml
  2. Make sure .htaccess says “ErrorDocument 404 /missing.shtml

:cool: openvein.org -//-


#7

okay… so you’re right. I didn’t have the shtml configured in the file name nor the .htaccess file.

that is done now and I CHMOD that file to 644;

so if i get a bad URL the default include in the search form field is:

/missing.shtml

theoretically if I typed in

www.blog.digitaltavern.com/foo.html - the foo.html would fill that field. no?


#8

Sorry. I used the wrong variable. Change DOCUMENT_URI to REQUST_URI

There are no string manipulation functions, and URIs will begin with a leading slash, so

visiting http://example.com/notfound will result in a URI /notfound and that is what will appear in the search box.

If you really need something better than that, you will need to use a CGI script instead.

:cool: openvein.org -//-