On 6/24/07, Xicheng Jia <[EMAIL PROTECTED]> wrote: > On 6/24/07, Xicheng Jia <[EMAIL PROTECTED]> wrote: > > Hi, folks, > > > > I am hoping to redirect URLs like: > > > > http://example.com/?question > > > > to > > > > http://example.com/doc/question.mhtml > > > > ########################### > > with dhandler's mechanism and currently in /dhandler, I set: > > > > <%init> > > my %redirects = ( > > '/?question' => '/doc/question.mhtml' > > ); > > > > # or combine $r->uri and $r->args to get $req > > my $req = $ENV{REQUEST_URI}; > > > > $r->content_type('text/html'); > > if (exists $redirects{ $req }) { > > $m->redirect($redirects{ $req }); > > } > > > > $m->clear_and_abort(404); > > </%init> > > ######################## > > > > If I don't do any more configuration with apache2, all links like > > http://example.com/?question always go directly to my homepage > > /index.mhtml no matter what query string I used after the '/?'. If I > > do the following configuration under Apache2. > > > > RewriteCond %{QUERY_STRING} !^$ > > RewriteRule ^/$ /nonexist.mhtml [L] > > > > ======== > > then "http://example.com/?question" will bring me to "/dhandler" but > > it displays plain text of dhandler instead of html even if I set > > $r->content_type. I guess this might becouse the 'redirection' occurs > > before the content generation phase thus the Mason handler does not > > get a chance to handle this. I have the following configuration in > > Apache:
Hi, folks: After reading the source from MasonHQ.com website, I realized that I made a mistake. The urls like /?Faq might be setup from Apache RewriteRules, not "Redirect" by 'dhandler'.. My bad, thanks anyway for your time.. Regards, Xicheng ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users