Feature #1407
closedReturn specific server status: 404 (Not Found), 301 (Moved Permanently)
0%
Description
Wt always returns 200 OK server status for requests within internal path structure. For sites aimed at search engines, this is not optimal behavior. (404 and 301 server status codes are often needed.)
404 Not Found: Koen proposed a solution here: http://redmine.webtoolkit.eu/boards/2/topics/1965#message-1975. It was to create a method void WApplication::setInternalPathValid(bool valid)
which would generate the 404 response in a plain HTML session and the page would be unchanged from thereon. Although, it would be perfectly fine if setting the 404 error would return a proper response and an error page setup with ---errroot.
301 Moved Permanently: void WApplication::redirect(...)
sets the 302 code upon redirection. As similar method or a parameter within this redirect function to set the 301 response instead would be of great benefit.
Regards
Updated by Koen Deforche about 12 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
- Target version set to 3.2.3
Hey,
I've added a few methods to my git copy that allow you to return a 404, but I think it's a bit of an experiment: because internal path handling can be 'distributed' to many widgets, this is not easy to handle correctly.
The methods are:
void setInternalPathDefaultValid(bool valid); // defaults to 'true'
bool internalPathDefaultValid() const;
void setInternalPathValid(bool valid);s
bool internalPathValid() const;
They have only an effect in plain HTML sessions (and probably are most useful only for bots), where they will return 404 for an invalid internal path.
Regards,
koen
Updated by Koen Deforche about 12 years ago
- Status changed from InProgress to Resolved
Updated by Koen Deforche about 12 years ago
- Status changed from Resolved to Closed