Re: apache RewriteEngine
Re: apache RewriteEngine
- Subject: Re: apache RewriteEngine
- From: Jesse Tayler <email@hidden>
- Date: Sun, 29 Jan 2012 20:34:48 -0500
nice!
but I must be having apache voodoo
links with
/apps/WebObjects/WOMan.woa/wa/signup
pass through
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/woman(.*)$ /apps/WebObjects/WOMan.woa$1 [PT,L]
</IfModule>
and resolve to
https://ec.planaby.com/woman/wa/signup
but apache reports 404, not found
I get the usual response from apachectl
> sudo apachectl graceful
[Sun Jan 29 19:55:21 2012] [warn] module WebObjects_module is already loaded, skipping
what did I miss here?
On Jan 29, 2012, at 7:31 PM, George Domurot wrote:
> Correct. And, if you use your default action as your entrance, then this will provide a nice URL starting point:
>
> http://domain/myapp
>
> -G
>
>
> On Jan 29, 2012, at 4:21 PM, Jesse Tayler wrote:
>
>> ah, let me see if I follow
>>
>> when I use a rule like
>>
>> RewriteRule ^/myapp(.*)$ /apps/WebObjects/MyApp.woa$1 [PT,L]
>>
>> a url with my myapp in it, would expand and all I'd need is the /wa/entrance or something like so?
>>
>> http://my.domain/myapp/wa/entrance
>>
>> am I following there?
>>
>>
>>
>> On Jan 29, 2012, at 6:39 PM, George Domurot wrote:
>>
>>> It looks like these options may be over complicating things. While you can get super fancy with rewrites, I've found it's easiest to use Wonder's built-in support and one singe rule to get deployed. If you need additional rules, you can stack them in above this one, otherwise this configuration should take care of you:
>>>
>>> 1) in your Resources/Properties file add (to get Wonder to rewrite during deployment):
>>>
>>> # Apache Deployment Rewrite
>>> er.extensions.ERXApplication.replaceApplicationPath.pattern=/cgi-bin/WebObjects/MyApp.woa
>>> er.extensions.ERXApplication.replaceApplicationPath.replace=/myapp
>>>
>>>
>>> 2) In your VirtualHost config, include (for Apache to reverse Wonder's rewrite from above):
>>>
>>> <IfModule mod_rewrite.c>
>>> RewriteEngine On
>>> RewriteRule ^/myapp(.*)$ /cgi-bin/WebObjects/MyApp.woa$1 [PT,L]
>>> </IfModule>
>>>
>>> -G
>>>
>>> On Jan 29, 2012, at 1:36 PM, Jesse Tayler wrote:
>>>
>>>>
>>>> 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
>>>
>>
>
_______________________________________________
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