Re: apache RewriteEngine
Re: apache RewriteEngine
- Subject: Re: apache RewriteEngine
- From: Jesse Tayler <email@hidden>
- Date: Sun, 29 Jan 2012 16:36:43 -0500
A quick test, I wrote a rule like yours
RewriteRule ^/(\d*?/?)wa/(.*)$ /apps/WebObjects/WOMan.woa/$1wa/$2 [L,PT,QSA]
that I'd expect to redirect a URL like this:
http://mydomain.com/wa/entrance
to
http://mydomain.com/apps/WebObjects/WOMan.woa/wa/entrance
aside from using SSL port :443 I don't see much there, I just added a simple virtual host to apache.conf.
I'm either misunderstanding the URL that should trigger this rule, or it's not working in a way I'm unsure how to debug -
thoughts?
On Jan 29, 2012, at 2:35 PM, Fabian Peters wrote:
>
> Am 29.01.2012 um 19:44 schrieb Jesse Tayler:
>
>>
>> oh thanks fabian!
>>
>> maybe just what I was looking for --
>>
>> the site is like twitter, so there's standard urls to reach a user profile, or a post and those urls should be short, of course.
>>
>>> They work for me, but I'm by no means a "rewrite expert"...
>>
>> rewrite expert? ick! who would want to be that!!
>>
>> I mean, the syntax looks like someone was drunk while slapping their hands on the keypad...
>>
>> On Jan 29, 2012, at 1:10 PM, Fabian Peters wrote:
>>
>>> # root rewrite
>>> RewriteRule ^/$ /cgi-bin/WebObjects/App.woa [L,PT]
>>>
>>
>> ah, so this basically translates anything into a full woa I guess?
>
> Yes
>
>>> RewriteRule ^/(\d*?/?)ajax/(.*)$ /cgi-bin/WebObjects/App.woa/$1ajax/$2 [L,PT,QSA]
>>> RewriteRule ^/(\d*?/?)upload(.*)$ /cgi-bin/WebObjects/App.woa/$1upload$2 [L,PT,QSA]
>>
>> I guess those two above translate standard ajax and file upload calls in the same way?
>
> Yes. The upload bit is for the AjaxFlexibleFileUpload IIRC.
>
>>> RewriteRule ^/(\d*?/?)wa/(.*)$ /cgi-bin/WebObjects/App.woa/$1wa/$2 [L,PT,QSA]
>>> RewriteRule ^/(\d*?/?)wo/(.*)$ /cgi-bin/WebObjects/App.woa/$1wo/$2 [L,PT,QSA]
>>> RewriteRule ^/(\d*?/?)wr(.*)$ /cgi-bin/WebObjects/App.woa/$1wr$2 [L,PT,QSA]
>>
>> and so, these I guess translate calls from errest, direct actions and basic components?
>
> DAs, component actions and the ERXStaticResourceRequestHandler - which you won't need in deployment I think. This was copied from my development apache config.
>
>> I can test around with these a bit, but I'm not certain I understand what they are doing --
>
>>> RewriteRule ^/(\d*?/?)wa/(.*)$ /cgi-bin/WebObjects/App.woa/$1wa/$2 [L,PT,QSA]
>
> The first group "(\d*?/?)" checks whether there's an instance ID in the URL and appends that as "$1". You might not need that. The second group "(.*)" takes the rest and appends it as "$2".
>
>> all cool, but you must also have some code in your app to return short urls during deployment?
>>
>> I used to have a menu item that used deployment urls for things like signup, but used component urls locally during development, but I am guessing with WOnder I might have a different approach there?
>
> Yes, you can set er.extensions.ERXApplication.replaceApplicationPath.pattern and er.extensions.ERXApplication.replaceApplicationPath.replace in your properties and use
>
> public String _rewriteURL(String url) {
> url = super._rewriteURL(url);
> ...
> return url;
> }
>
> in your ERXApplication subclass if you need more special things.
>
> Fabian
_______________________________________________
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