Notes 9, rewriting URLs

余生颓废 提交于 2019-12-10 11:18:40

问题


How do you rewrite a URL in Notes 9 XPages.

Let's say I have:

www.example.com/myapp.nsf/page-name

How do I get rid of that .nsf part:

www.example.com/page-name

I don't want to do lots of manual re-direct because my pages are dynamically formed like wordpress.

I've read this: http://www.ibm.com/developerworks/lotus/library/ls-Web_site_rules/

It does not address the issue.


回答1:


If you use substitution rules like the following, you can get rid of the db.nsf part and call your XPages directly as example.com/xpage1.xsp:

Rule (substitution): /db.nsf/* -> /db.nsf/*
Rule (substitution): /* -> /db.nsf/*

However, you have to "manually" generate your URLs without the db.nsf part in e.g. menus because the XPages runtime will include the db.nsf part in the URLs if you use for instance the openPage simple action.




回答2:


To completely control what is going in and out put your Domino behind an Apache HTTP and use mod_rewrite. On Domino 9.0 Windows you can use mod_domino




回答3:


You can do it with a mix of subsitutions, "URL-pattern" and paritial refresh.

I had the same problem, my customers wants clean URLs for SEO.

My URLs now looks like these:

www.myserver.de/products/financesoftware/anyproduct

First i used one subsitution to cover the folder, database and xpage part of the URL. My substitution: "/products" -> "/web/techdemo.nsf/product.xsp"

Problem with these is, any update on this site (with in redirect mode) and the user gets back the "dirty" URL. I solved this with the use of paritial refreshes only.

Last but not least, i uses my own slash pattern at the end of the xpage call (.xsp) In my case thats the "/financesoftware/anyproduct/" part. I used facesContext.getExternalContext().getRequestPathInfo() to resolve that URL part.

Currently i used good old RegExp to get the slash separated parameters back out of the url, but i am investigating a REST solution at the moment.




回答4:


I haven't actually done this, but just saw the option yesterday while looking for something else. In your Xpage, go to All Properties, and look at 'navigationRules' and 'pageBaseUrl'. I think you will find what you are looking for there.



来源:https://stackoverflow.com/questions/16446291/notes-9-rewriting-urls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!