Re: [WebDNA] set HTTP-Status Code from webdna

This WebDNA talk-list message is from

2016


It keeps the original formatting.
numero = 112670
interpreted = N
texte = 253 --Apple-Mail=_87A8043F-3160-4885-A7C6-3E41DC8A7A33 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Noah,=20 Similar to you, and wanting to use pretty URLs I built something = similar, but did it a different way. _All_ page requests are caught by a url-rewrite rule and get sent to = dispatch.tpl Dispatch.tpl has hundreds of rules that decide what page to show, and = uses includes to do it.=20 (this keeps everything in-house to webdna so i don=E2=80=99t have to go = mucking about in webdna here, and apache there, and linux somewhere = else, and etc=E2=80=A6)=20 Three special circumstances came up that needed special code to send out = proper HTTP status codes: [function name=3D301public] [text]eol=3D[unurl]%0D%0A[/unurl][/text] [returnraw]HTTP/1.1 301 Moved Permanently[eol]Location: = http://www.example.com[link][eol][eol][/returnraw] [/function] [function name=3D404hard] [text]eol=3D[unurl]%0D%0A[/unurl][/text] [returnraw]HTTP/1.0 404 Not Found[eol]Status: 404 Not = Found[eol]Content-type: text/html[eol][eol][eol][eol]

404 = Not Found

[eol]The page that you have requested ([thisurl]) could = not be found.[eol][eol][/returnraw] [/function] [function name=3D404soft] [text]eol=3D[unurl]%0D%0A[/unurl][/text] [returnraw]HTTP/1.0 404 Not Found[eol]Status: 404 Not = Found[eol]Content-type: text/html[eol][eol][include = file=3D/404pretty.tpl][/returnraw] [/function] Hope this helps -Brian B. Burton > On Mar 24, 2016, at 10:53 AM, Noah Valley wrote: >=20 > Hi everybody, >=20 > The Question First: Is it possible to set the HTTP-Status Codes with = webdna? >=20 > Explanation why we need to do this: > I=E2=80=99ve been working with webdna for 3 years now but our our = business is on webdna since the 90ies; using it for a web-cms and custom = web-solutions. We now host about 150 websites on lighttpd. > We newly started using "url-rewrite" so we can have custom urls for = our websites. It directs calls from domain.com/cms/something = to domain.com/cms.dna?url=3Dsomething = .=20 > Example: Visitor goes to domain.com/cms/aboutus = and it shows domain.com/ = cms.dna = ?url=3Daboutus -> webdna = finds =E2=80=9Eaboutus" in DB and shows correct site > Problem: Visitor goes to domain.com/cms/somethingwrong = and it shows domain.com/ = cms.dna = ?url=3Dsomethingwrong -> = webdna does not find somethingwrong in DB and shows an error-page but = the HTTP status remains 200! >=20 > Is it possible to set the HTTP-Status Code with webdna? In this case = to 404 in other cases to something else. Or how would you solve that = problem? >=20 > Thanks! >=20 > Noah Valley > mac&web gmbh > S=C3=A4ntistrasse 13 > 8200 schaffhausen > switzerland >=20 > Tel +41 52 620 30 60 > Fax +41 52 620 30 61 > valley@mac-web.ch > www.mac-web.ch >=20 > --------------------------------------------------------- This message = is sent to you because you are subscribed to the mailing list . To = unsubscribe, E-mail to: archives: = http://mail.webdna.us/list/talk@webdna.us Bug Reporting: = support@webdna.us --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us --Apple-Mail=_87A8043F-3160-4885-A7C6-3E41DC8A7A33 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Noah, 

Similar to you, and wanting to use pretty URLs I built = something similar, but did it a different way.
_All_ = page requests are caught by a url-rewrite rule and get sent to = dispatch.tpl
Dispatch.tpl has hundreds of rules = that decide what page to show, and uses includes to do = it. 
(this keeps everything in-house to webdna = so i don=E2=80=99t have to go mucking about in webdna here, and apache = there, and linux somewhere else, and etc=E2=80=A6) 

Three special = circumstances came up that needed special code to send out proper HTTP = status codes:

<!=E2=80=94 for page URLS that have permanently moved = (webdna sends out a 302 temporarily moved code on a redirect) = =E2=80=94>
[function = name=3D301public]
[text]eol=3D[unurl]%0D%0A[/unurl][/text]
[returnraw]HTTP/1.1 301 Moved Permanently[eol]Location: http://www.example.com[link][eol][eol][/returnraw]
[/function]

<!=E2=80=94 I send this to non google/bing/yahoo bots and = other attempting to crawl/copy the entire site=E2=80=94>
[function name=3D404hard]
[text]eol=3D[unurl]%0D%0A[/unurl][/text]
[returnraw]HTTP/1.0 404 Not Found[eol]Status: 404 Not = Found[eol]Content-type: = text/html[eol][eol]<html>[eol]<body>[eol]<h1>404 Not = Found</h1>[eol]The page that you have requested ([thisurl]) could = not be found.[eol]</body>[eol]</html>[/returnraw]
[/function]

<!=E2=80=94 and finally a pretty 404 page for humans = =E2=80=94>
[function name=3D404soft]
[text]eol=3D[unurl]%0D%0A[/unurl][/text]
[returnraw]HTTP/1.0 404 Not Found[eol]Status: 404 Not = Found[eol]Content-type: text/html[eol][eol][include = file=3D/404pretty.tpl][/returnraw]
[/function]

Hope this helps
-Brian B. Burton


On Mar 24, 2016, at 10:53 AM, Noah Valley <valley@mac-web.ch> = wrote:

Hi = everybody,

The = Question First: Is it possible to set the HTTP-Status Codes with = webdna?

Explanation why we need to do this:
I=E2=80= =99ve been working with webdna for 3 years now but our our business is = on webdna since the 90ies; using it for a web-cms and custom = web-solutions. We now host about 150 websites on lighttpd.
We newly started using "url-rewrite" so we can have custom = urls for our websites. It directs calls from domain.com/cms/something to domain.com/cms.dna?url=3Dsomething
Example: Visitor goes to domain.com/cms/aboutus and it shows domain.com/cms.dna?url=3Daboutus -> webdna finds =E2=80=9Eabou= tus" in DB and shows correct site
Problem: Visitor = goes to domain.com/cms/somethingwrong and it shows domain.com/cms.dna?url=3Dsomethingwrong -> webdna does = not find somethingwrong in DB and shows an error-page but the HTTP = status remains 200!

Is it possible to set the HTTP-Status Code with webdna? In = this case to 404 in other cases to something else. Or how would you = solve that problem?

Thanks!

Noah Valley
mac&web = gmbh
S=C3=A4ntistrasse 13
8200 = schaffhausen
switzerland

Tel = +41 52 620 30 60
Fax +41 52 620 30 61
valley@mac-web.ch
www.mac-web.ch

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us

= --Apple-Mail=_87A8043F-3160-4885-A7C6-3E41DC8A7A33-- . Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] set HTTP-Status Code from webdna (Brian Burton 2016)
  2. Re: [WebDNA] set HTTP-Status Code from webdna (Noah Valley 2016)
  3. Re: [BULK] Re: [WebDNA] set HTTP-Status Code from webdna (Tom Duke 2016)
  4. Re: [BULK] Re: [WebDNA] set HTTP-Status Code from webdna (Brian Burton 2016)
  5. Re: [BULK] Re: [WebDNA] set HTTP-Status Code from webdna (christophe.billiottet@webdna.us 2016)
  6. Re: [WebDNA] set HTTP-Status Code from webdna (Brian Burton 2016)
  7. [BULK] Re: [WebDNA] set HTTP-Status Code from webdna (Brian Burton 2016)
  8. Re: [WebDNA] set HTTP-Status Code from webdna (Jym Duane 2016)
  9. Re: [WebDNA] set HTTP-Status Code from webdna (Noah Valley 2016)
  10. Re: [WebDNA] set HTTP-Status Code from webdna (Brian Burton 2016)
  11. [WebDNA] set HTTP-Status Code from webdna (Noah Valley 2016)
253 --Apple-Mail=_87A8043F-3160-4885-A7C6-3E41DC8A7A33 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Noah,=20 Similar to you, and wanting to use pretty URLs I built something = similar, but did it a different way. _All_ page requests are caught by a url-rewrite rule and get sent to = dispatch.tpl Dispatch.tpl has hundreds of rules that decide what page to show, and = uses includes to do it.=20 (this keeps everything in-house to webdna so i don=E2=80=99t have to go = mucking about in webdna here, and apache there, and linux somewhere = else, and etc=E2=80=A6)=20 Three special circumstances came up that needed special code to send out = proper HTTP status codes: [function name=3D301public] [text]eol=3D[unurl]%0D%0A[/unurl][/text] [returnraw]HTTP/1.1 301 Moved Permanently[eol]Location: = http://www.example.com[link][eol][eol][/returnraw] [/function] [function name=3D404hard] [text]eol=3D[unurl]%0D%0A[/unurl][/text] [returnraw]HTTP/1.0 404 Not Found[eol]Status: 404 Not = Found[eol]Content-type: text/html[eol][eol][eol][eol]

404 = Not Found

[eol]The page that you have requested ([thisurl]) could = not be found.[eol][eol][/returnraw] [/function] [function name=3D404soft] [text]eol=3D[unurl]%0D%0A[/unurl][/text] [returnraw]HTTP/1.0 404 Not Found[eol]Status: 404 Not = Found[eol]Content-type: text/html[eol][eol][include = file=3D/404pretty.tpl][/returnraw] [/function] Hope this helps -Brian B. Burton > On Mar 24, 2016, at 10:53 AM, Noah Valley wrote: >=20 > Hi everybody, >=20 > The Question First: Is it possible to set the HTTP-Status Codes with = webdna? >=20 > Explanation why we need to do this: > I=E2=80=99ve been working with webdna for 3 years now but our our = business is on webdna since the 90ies; using it for a web-cms and custom = web-solutions. We now host about 150 websites on lighttpd. > We newly started using "url-rewrite" so we can have custom urls for = our websites. It directs calls from domain.com/cms/something = to domain.com/cms.dna?url=3Dsomething = .=20 > Example: Visitor goes to domain.com/cms/aboutus = and it shows domain.com/ = cms.dna = ?url=3Daboutus -> webdna = finds =E2=80=9Eaboutus" in DB and shows correct site > Problem: Visitor goes to domain.com/cms/somethingwrong = and it shows domain.com/ = cms.dna = ?url=3Dsomethingwrong -> = webdna does not find somethingwrong in DB and shows an error-page but = the HTTP status remains 200! >=20 > Is it possible to set the HTTP-Status Code with webdna? In this case = to 404 in other cases to something else. Or how would you solve that = problem? >=20 > Thanks! >=20 > Noah Valley > mac&web gmbh > S=C3=A4ntistrasse 13 > 8200 schaffhausen > switzerland >=20 > Tel +41 52 620 30 60 > Fax +41 52 620 30 61 > valley@mac-web.ch > www.mac-web.ch >=20 > --------------------------------------------------------- This message = is sent to you because you are subscribed to the mailing list . To = unsubscribe, E-mail to: archives: = http://mail.webdna.us/list/talk@webdna.us Bug Reporting: = support@webdna.us --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us --Apple-Mail=_87A8043F-3160-4885-A7C6-3E41DC8A7A33 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Noah, 

Similar to you, and wanting to use pretty URLs I built = something similar, but did it a different way.
_All_ = page requests are caught by a url-rewrite rule and get sent to = dispatch.tpl
Dispatch.tpl has hundreds of rules = that decide what page to show, and uses includes to do = it. 
(this keeps everything in-house to webdna = so i don=E2=80=99t have to go mucking about in webdna here, and apache = there, and linux somewhere else, and etc=E2=80=A6) 

Three special = circumstances came up that needed special code to send out proper HTTP = status codes:

<!=E2=80=94 for page URLS that have permanently moved = (webdna sends out a 302 temporarily moved code on a redirect) = =E2=80=94>
[function = name=3D301public]
[text]eol=3D[unurl]%0D%0A[/unurl][/text]
[returnraw]HTTP/1.1 301 Moved Permanently[eol]Location: http://www.example.com[link][eol][eol][/returnraw]
[/function]

<!=E2=80=94 I send this to non google/bing/yahoo bots and = other attempting to crawl/copy the entire site=E2=80=94>
[function name=3D404hard]
[text]eol=3D[unurl]%0D%0A[/unurl][/text]
[returnraw]HTTP/1.0 404 Not Found[eol]Status: 404 Not = Found[eol]Content-type: = text/html[eol][eol]<html>[eol]<body>[eol]<h1>404 Not = Found</h1>[eol]The page that you have requested ([thisurl]) could = not be found.[eol]</body>[eol]</html>[/returnraw]
[/function]

<!=E2=80=94 and finally a pretty 404 page for humans = =E2=80=94>
[function name=3D404soft]
[text]eol=3D[unurl]%0D%0A[/unurl][/text]
[returnraw]HTTP/1.0 404 Not Found[eol]Status: 404 Not = Found[eol]Content-type: text/html[eol][eol][include = file=3D/404pretty.tpl][/returnraw]
[/function]

Hope this helps
-Brian B. Burton


On Mar 24, 2016, at 10:53 AM, Noah Valley <valley@mac-web.ch> = wrote:

Hi = everybody,

The = Question First: Is it possible to set the HTTP-Status Codes with = webdna?

Explanation why we need to do this:
I=E2=80= =99ve been working with webdna for 3 years now but our our business is = on webdna since the 90ies; using it for a web-cms and custom = web-solutions. We now host about 150 websites on lighttpd.
We newly started using "url-rewrite" so we can have custom = urls for our websites. It directs calls from domain.com/cms/something to domain.com/cms.dna?url=3Dsomething
Example: Visitor goes to domain.com/cms/aboutus and it shows domain.com/cms.dna?url=3Daboutus -> webdna finds =E2=80=9Eabou= tus" in DB and shows correct site
Problem: Visitor = goes to domain.com/cms/somethingwrong and it shows domain.com/cms.dna?url=3Dsomethingwrong -> webdna does = not find somethingwrong in DB and shows an error-page but the HTTP = status remains 200!

Is it possible to set the HTTP-Status Code with webdna? In = this case to 404 in other cases to something else. Or how would you = solve that problem?

Thanks!

Noah Valley
mac&web = gmbh
S=C3=A4ntistrasse 13
8200 = schaffhausen
switzerland

Tel = +41 52 620 30 60
Fax +41 52 620 30 61
valley@mac-web.ch
www.mac-web.ch

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us

= --Apple-Mail=_87A8043F-3160-4885-A7C6-3E41DC8A7A33-- . Brian Burton

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

RE: OK, here goes... (1997) [OT] Ratings comparison? (2003) Cross OS Compatible HTML emailing (2003) more on the Shipcost update problem (1997) WebCat2 beta 11 - new prefs ... (1997) Stopping bad HTML propagation ? (1997) WebCat2b15MacPlugin - showing [math] (1997) WebMerchant Integration with Verifone's vPOS (1998) Database formats (2003) [WebDNA] [OT] Best Mail Server (2010) forming a SKU (1999) Can you do this??? and other stuff (1997) Only charge card when product shipped ? (1997) Using WC for Bulk Emailings (1997) WebCat2.0 [format thousands .0f] no go (1997) WebCat ignoring Shopping Cart Folder (2001) Attention eCommerce Sites (deadline 12/12) (1997) Order not created error (1997) Calculating multiple shipping... (1997) Single Link browsing (1997)