Re: [OT] Apache rewrite rule
Re: [OT] Apache rewrite rule
- Subject: Re: [OT] Apache rewrite rule
- From: Dev WO <email@hidden>
- Date: Wed, 3 Nov 2010 17:29:46 +0100
Hello Jeff,
On your server you may have virtual host setup, so the rewrite rule has to be put inside the virtual host configuration /etc/apache2/sites/ for each site that need it.
Xavier
> Did this on my dev machine and it worked great, but on my leopard server deployment machine I added the same entry in /etc/apache2/httpd.conf and no dice. The shorter URL's are being output from my app using the Wonder er.extensions.ERXApplication.replaceApplicationPath properties, but I get the "requested URL not found" error when I click on one of them. Nothing in the rewrite.log file. Is there some other property to set in httpd.conf or elsewhere?
>
> Thanks,
> Jeff
>
>
> On Apr 16, 2009, at 9:50 AM, Kieran Kelleher wrote:
>
>> Finally! Searching the apache docs more, I found another option PT, the passthrough option, that specifically refers to this being needed for mod_alias or using mod_rewrite with any other modules that do URI-to-filename mapping or translation.
>>
>> The final working rewrite rule is:
>>
>> <IfModule rewrite_module>
>> # rewrite logging
>> RewriteLog "/var/log/apache2/rewrite.log"
>>
>> # PURL feature
>> RewriteEngine On
>> RewriteRule ^/purl/(.*)$ /cgi-bin/WebObjects/cheetah.woa/-52040/wa/PurlAction/purl?p=$1 [PT]
>> </IfModule>
>>
>> Thanks for the mind-prodding guys.
>>
>> Now it is working in apache2 on my dev machine. Hopefully apache 1.3 will be similar configuration when I deploy this feature in a few days.
>>
>> Regards, Kieran
>>
>> On Apr 16, 2009, at 10:28 AM, Kieran Kelleher wrote:
>>
>>> I added an [R] option on the end of the rule to force an external redirect and it works, albeit the URL in the browser address bar becomes the ugly one. So, at least this is returning the page ... not let's see if I can make it do without an external redirect so that the short URL stays in the browser address bar .... (since the marketing design spec wants the short URL)
>>>
>>> <IfModule rewrite_module>
>>> # rewrite logging
>>> RewriteLog "/tmp/rewrite.log"
>>>
>>> # PURL feature
>>> RewriteEngine On
>>> RewriteRule ^/purl/(.*)$ /cgi-bin/WebObjects/cheetah.woa/-52040/wa/PurlAction/purl?p=$1 [R]
>>> </IfModule>
>>>
>>>
>>> On Apr 16, 2009, at 10:17 AM, Kieran Kelleher wrote:
>>>
>>>> I am using WO 5.3 on leopard with apache 2.2.9. The wo module is coming before rewrite module in httpd.conf:
>>>> LoadModule WebObjects_module /System/Library/WebObjects/Adaptors/Apache2.2/mod_WebObjects.so
>>>> LoadModule rewrite_module libexec/apache2/mod_rewrite.so
>>>>
>>>> Further investigation shows that each time I try to access the short URL, I see the following error in the apache error_log:
>>>> [Thu Apr 16 10:12:15 2009] [error] [client ::1] File does not exist: /Library/WebServer/Documents/cgi-bin
>>>>
>>>> So just maybe the rewrite rule is working but the result may be conflicting with mod_alias which has a scriptalias entry for the wo cgi-bin???
>>>>
>>>> Does that ring any bells with anyone?
>>>>
>>>> Kieran
>>>>
>>>>
>>>>
>>>> On Apr 16, 2009, at 10:08 AM, Mike Schrag wrote:
>>>>
>>>>> if you're rewriting to wo instances, you need to make sure the ordering of your modules is right, too ... in 5.3 (i don't know about 5.4), the order of the modules was wrong -- you have to make mod_webobjects come before mod_rewrite (iirc).
>>>>>
>>>>> ms
>>>>>
>>>>> On Apr 16, 2009, at 9:25 AM, Kieran Kelleher wrote:
>>>>>
>>>>>> Hello list,
>>>>>>
>>>>>> Well when Brian Moore said mod_rewrite was voodoo (http://httpd.apache.org/docs/2.2/rewrite/), I was skeptical, but now I believe him! I need some help for what I think should be a pretty simple rewrite rule. I am currently trying to get this to work initially on my development machine, and I keep getting a 404 "Not Found" message from apache (version 2.2.9).
>>>>>>
>>>>>> The rule is supposed to take convert URLs like this :
>>>>>> http://localhost/purl/KieranKelleher
>>>>>>
>>>>>> and rewrite them like this (on my dev machine):
>>>>>> http://localhost/cgi-bin/WebObjects/cheetah.woa/-52040/wa/PurlAction/purl?p=KieranKelleher
>>>>>>
>>>>>> I have added this to the end of my /etc/apache2/httpd.conf just before the last 2 includes at the end of the file (other/*.conf and WO apache.conf)
>>>>>>
>>>>>> <IfModule rewrite_module>
>>>>>> # rewrite logging
>>>>>> RewriteLog "/tmp/rewrite.log"
>>>>>>
>>>>>> # PURL feature
>>>>>> RewriteEngine On
>>>>>> RewriteRule ^/purl/(.*)$ /cgi-bin/WebObjects/cheetah.woa/-52040/wa/PurlAction/purl?p=$1
>>>>>> </IfModule>
>>>>>>
>>>>>> I can confirm that when I restarted apache it creates the /tmp/rewrite.log if it does not exist, however nothing gets written there.
>>>>>>
>>>>>> I have studied the docs, the wiki docs and many examples. This looks like it should work, but I cannot for the life of me figure out why it does not work :-(
>>>>>>
>>>>>> Any clues or hints would be appreciated.
>>>>>>
>>>>>> Thanks, Kieran
>>>>>> _______________________________________________
>>>>>> 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
>>>>
>>>> _______________________________________________
>>>> 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
>>
>> _______________________________________________
>> 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
>
_______________________________________________
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