• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Having WO respond to direct URLs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Having WO respond to direct URLs


  • Subject: Re: Having WO respond to direct URLs
  • From: Mike Schrag <email@hidden>
  • Date: Mon, 19 Sep 2005 13:19:03 -0400

Apache rewrite rules is the path of least resistance. Here is an excerpt from one of our apps:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/$ /page/HomePage [R]
RewriteCond %{QUERY_STRING} ^appNum=([-0-9]+)(.*)$
RewriteRule ^/page/(.*)$ /cgi-bin/WebObjects/ YourApp.woa/%1/wa/viewPage?pageName=$1%2 [L,PT]
RewriteRule ^/page/(.*)$ /cgi-bin/WebObjects/ YourApp.woa/wa/viewPage?pageName=$1 [L,PT,QSA]
</IfModule>


http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html for full docs. Just for reference, the rules above do:

                RewriteRule ^/$ /page/HomePage [R]
If someone just requests "/", send a redirect to /page/HomePage

RewriteCond %{QUERY_STRING} ^appNum=([-0-9]+)(.*)$
Only execute the next line if the query string matches appNum=a number and capture the number and everything after it in %1 and %2


RewriteRule ^/page/(.*)$ /cgi-bin/WebObjects/ YourApp.woa/%1/wa/viewPage?pageName=$1%2 [L,PT]
(only executed given the above condition), replace /page/Something with /cgi-bin/WebObjects/YourApp.woa/{appNumber}/wa/viewPage? pageName=Something{followed by the captured %2 from above}. L = this is the last rule, stop evaluating if this matches, PT=pass through to the next request handler in the chain


RewriteRule ^/page/(.*)$ /cgi-bin/WebObjects/ YourApp.woa/wa/viewPage?pageName=$1 [L,PT,QSA]
pretty much the same as above but doesn't deal with multiple instances; QSA = append the query string from the original request to the rewritten url


The app then generates URL of the type "/page/PageName? appNum=x&wosid=y".

ms

On Sep 19, 2005, at 12:55 PM, Danny Wang wrote:

I'm trying to get an app running where I can have users of the site hit their home page/portal when they type http://mywebsite/ username. The users will get created automatically and user names will be unique. The questions is how do I get WO to respond to URLs like that? It'll be ok to have a redirection (to the WO app URL), but I can't think of a way to automatically generate that URL and have my WO app respond to it.

Or, even if there's no good way to have it get automatically created, it would be nice to have that kind of a link somehow. The only thing I can think of is to create the directory in the WebServer directoy and put a html page that redirects to the WO app using Direct Actions.

Thanks for any ideas! I really appreciate the help this list has given me over the course of this project...maybe someday I'll have something useful to contribute. =)

--
Danny
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mdimension.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Having WO respond to direct URLs (From: Danny Wang <email@hidden>)

  • Prev by Date: Re: Having WO respond to direct URLs
  • Next by Date: Re: Deploying on Development System
  • Previous by thread: Re: Having WO respond to direct URLs
  • Next by thread: LDAP Authentication WebObjects 5.3
  • Index(es):
    • Date
    • Thread