Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
8
Erster Beitrag:
vor 4 Jahren, 7 Monaten
Letzter Beitrag:
vor 4 Jahren, 1 Monat
Beteiligte Autoren:
Alexander S., Fabrice Harari, Olivier P., Marijn, Alexandre Leclerc

How to change HTTP header of .awp page?

Startbeitrag von Alexander S. am 20.04.2013 08:55

Hi All!
I have a page with id parameter of product id.
When the product deleted I would like to redirect the user on the error page with my message and HTTP header with response 404 (Page not found).
How I can make this?

I need something like these in PHP:

// Page was not found:
header('HTTP/1.1 404 Not Found');

// Access forbidden:
header('HTTP/1.1 403 Forbidden');

// The page moved permanently should be used for
// all redrictions, because search engines know
// what's going on and can easily update their urls.
header('HTTP/1.1 301 Moved Permanently');

I can use a PageDispaly function, but its status always: HTTP request status: 200 (OK)

(We need it for SEO.)

Antworten:

Hi Alexander,

As far as I know this is not yet possible in version 18. I've seen questions about that from version 15.

Even if this does not help you, I would suggest that you send a request to the free technical support to ask for this feature (giving a small reason why you need this option). And also ask them at the same time how you can achieve the desired behaviour with the current version you use. (Who knows, maybe there is a trick.)

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 23.04.2013 12:43
I have sent the request to to the free technical support 4 days ago but still no answer...

von Alexander S. - am 23.04.2013 12:57
Hi Alexander

Just an idea (not tested)
- webdev allows you to customize the error pages (404 in this case)... I do not know to what extent, as I've never used that functionnality, but maybe enough for your need
- if that is the case, then in your page init code, you should be able to do a scriptexecute of a FALSE url on your site that gives the desired 404 answer

Let us know if it works

Best regards

von Fabrice Harari - am 23.04.2013 14:59
Quote
Fabrice Harari
- webdev allows you to customize the error pages (404 in this case)... I do not know to what extent, as I've never used that functionnality, but maybe enough for your need
- if that is the case, then in your page init code, you should be able to do a scriptexecute of a FALSE url on your site that gives the desired 404 answer


1) you can customize Error page only in Dynamic Webdev site (not AWP)
2) it is possible to generate FALSE url, but I need to return 404 code on my normal page (when product deleted for example)

I did not found the solution and I am in a blind alley ((

von Alexander S. - am 23.04.2013 15:14
Hi Alexander

I did a little digging outside the webdev world, and it seems that there are way to set the header returned by the web server... To do that I did the following google search: "set http header 404 server side"...

The answer seems to reside in server side scripting...

Let us know if that geives you a solution

Best regards

von Fabrice Harari - am 23.04.2013 19:54
Sorry for the late reply, but you can generate a 404 by doing some imho ugly coding.

Basically you neet to put a scriptdisplay or phpdisplay of a non existing page in the global declaration of a page or in the project initialisation.

The script display will try to display the html including the header of the page you want to display, but can only accomplish this as long as the header isn't send to the client yet. Depending on your server configuration this has either already happened or not so you need to play with that for a bit. The further you get in the code the more likely it is that the page header has already been submitted.

Hope this helps,

Marijn

von Marijn - am 01.10.2013 14:34
Hello,

I'm late to responds but I use that "technique" since a long time (many WB versions).

It works well and you can also make redirection with that too.
In fact the trick reside in using the "MIMEType" parameter properly :

To do a 404 error :
ChaîneAffiche("", "text/html" + RC + "Status: 404" + RC + "Connection: close" + RC)

To do a redirection :
sLibHTML est une chaîne = [
Document Moved
Object MovedThis document may be found here
]
ChaîneAffiche(ChaîneConstruit(sLibHTML, sAdresse), "text/html" + RC + "Status: 302" + RC+ "Location: " + sAdresse + RC + "Connection: close" + RC)

Hope this helps !

See you

von Olivier P. - am 03.10.2013 14:35
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.