• 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: [OT] Apache rewrite rule
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] Apache rewrite rule


  • Subject: Re: [OT] Apache rewrite rule
  • From: Tim Worman <email@hidden>
  • Date: Thu, 16 Apr 2009 09:36:13 -0700

Kieran et al:

I just went through some rewrite stuff although it was more related to just getting multiple apps working at different virtual hosts. This site has a really nicely done mod_rewrite cheat sheet (PDF):

http://www.addedbytes.com/apache/mod_rewrite-cheat-sheet

Also, after your RewriteLog command you could add:

RewriteLogLevel 9

It does help a little with the debugging. I don't think anything over '2' is recommended in deployment but you'll learn a lot by amping it up as high as it can go while you're troubleshooting this stuff. Sorry if I'm just spewing stuff you already knew about.

Tim
UCLA GSE&IS

On Apr 16, 2009, at 7: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
  • Follow-Ups:
    • Re: [OT] Apache rewrite rule
      • From: Kieran Kelleher <email@hidden>
References: 
 >[OT] Apache rewrite rule (From: Kieran Kelleher <email@hidden>)
 >Re: [OT] Apache rewrite rule (From: Mike Schrag <email@hidden>)
 >Re: [OT] Apache rewrite rule (From: Kieran Kelleher <email@hidden>)
 >Re: [OT] Apache rewrite rule (From: Kieran Kelleher <email@hidden>)
 >Re: [OT] Apache rewrite rule (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: wotaskd password
  • Next by Date: Re: JavaClient offline storage / replication
  • Previous by thread: Re: [OT] Apache rewrite rule
  • Next by thread: Re: [OT] Apache rewrite rule
  • Index(es):
    • Date
    • Thread