Jag har för länge sedan ändrat min "page not found"-felmeddelande till en hemmagjord mall och har varit nöjd med det en längre tid.
Provade att slå upp alla sidor som google har indexerat och det visade sig att de hade väldigt många gamla sidor som inte finns kvar. Tänkte att jag skulle försöka åtgärda det.
Hur kan man få min MyError.asp sida att skicka vidare http header 404 när någon besöker sidan?
google skrev:
Remove an outdated link
Google updates its entire index automatically on a regular basis. When we crawl the web, we find new pages, discard dead links, and update links automatically. Links that are outdated now will most likely "fade out" of our index during our next crawl.
Note: If you believe your request is urgent and cannot wait until the next time Google crawls your site, use our automatic URL removal system. We'll accept your removal request only if the page returns a true 404 error via the http headers. Please ensure that you return a true 404 error even if you choose to display a more user-friendly body of the HTML page for your visitors. It won't help to return a page that says "File Not Found" if the http headers still return a status code of 200, or normal.
The ASP page script must be terminated after sending the 301 header, and you must not output any content, not even a single space, before the header. Everything after Response.End will not be executed.
'VBScript:
Dim newLocation
newLocation = "http://www.example.com/other-directory/other-page.asp"
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", newLocation
Response.End
A) Är det verkligen så? Min önskan är att få visa min hemmabygda error 404 sida men samtidigt returnera en korrekt header. Kan man inte komma runt response.end på något sätt?
B) Hur testar jag att min websida verkligen returnerar rätt http header?
Inte för 404. Texten du citerar gäller 301. 404 är att sidan inte finns. 301 är att sidan finns, men på ett annat ställe, och man skickas dit automatiskt.
Mattias Nordin skrev:
B) Hur testar jag att min websida verkligen returnerar rätt http header?