Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

NaviServer redirects

瀏覽次數:43 次
跳到第一則未讀訊息

P8j6

未讀,
2017年4月3日 上午11:43:172017/4/3
收件者:
Hi!

I dont know where to ask for help with NaviServer, so, since NaviServer is about Tcling, i putting it here :)
If someone can point me to any other NaviServer learning-friendly discussions, i would be glad.

My question:

What is the best approach to redirect www version of url to non-www?

Create virtual server for www version and then register proc which will redirect all traffic to non-www virtual server.

Or point both domains to one virtual and use filter of some kind?

Or someting else?

Thx for help!

stefan

未讀,
2017年4月3日 下午4:13:142017/4/3
收件者:
Hi!

> I dont know where to ask for help with NaviServer, so

Use this mailing list:
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

> If someone can point me to any other NaviServer learning-friendly discussions, i would be glad.

It is fine to post here and point naviserver-devel to your c.l.t post, don't cross-post though.

> My question:
>
> What is the best approach to redirect www version of url to non-www?
>

It depends.

> Create virtual server for www version and then register proc which will redirect all traffic to non-www virtual server.

1) Use a "www CNAME @"?
2) Registering a www-redirecting vhost is more likely to be economical:

ns_section "ns/module/nssock/servers"
ns_param www www.example.com

ns_section "ns/server/www"
ns_param hostname www.example.com
ns_param library $serverdir/tcl

in $serverdir/tcl create a tcl script which register sth. along the lines:

proc nonWWW {} {
# nicer if you'd get the redirect hostname from the config file.
set url http://example.com[ns_conn url]
set q [ns_conn query]
if {$q ne ""} {append url ? $q}
ns_returnmoved $url
}

ns_register_proc GET /* nonWWW

(run ns_register_proc for the other HTTP methods also)

There might be sth. more elegant, but for that, you need to reach out to the NaviServer ninjas. Also, mind that the above is untested and from the top of my head.

HTH,
Stefan
0 則新訊息