| BachusII on Dec 30, 2005 at 4:27:22 PM (# 5) It's not recommended to use the rewritelogs unless during testing. They fill up quick, real quick. cdrom600 on Dec 31, 2005 at 5:31:18 PM (# 6)All right, it seems that in addition to learning about regular expressions, I need to learn more about mod_rewrite.
I didn't know anything about rewrite logs - they seem useful, though...
Thanks for your help. I'll look into these solutions and get back to you. cdrom600 on Dec 31, 2005 at 5:39:58 PM (# 7)Good news! The following code works beautifully:
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx RewriteCond %{QUERY_STRING} !coral-no-serve$ RewriteRule ^(.*\.mp3) http://%{HTTP_HOST}.nyud.net:8090/$1 [R,L] RewriteRule ^(.*\.jpg) http://%{HTTP_HOST}.nyud.net:8090/$1 [R,L]
Two small changes:
- I've added a
RewriteRule for JPEGs also - I've removed the
/ from the beginning of each of the regular expressions, so that the rules will work even in subdirectories. You could also leave the / and anchor the regex to the end of the string, I think.
Thanks, guys! I have a lot of learning to do...
And Happy New Year! Be safe. BachusII on Jan 1, 2006 at 12:03:31 AM (# 8)^ signifies start of the string.
The slash was taken out of the parenthesis to avoid an url with a double slash at the beginning of the resulting redirect. Because of the slash in http://%{http_host}.nyud.net:8090/$1, an url of http://server.name/path/somefile.mp3 (/path/somefile.mp3 would be what is caught by your regex) will result in http://%{http_host}.nyud.net:8090//path/somefile.mp3 That doesn't result in any problems for the server. I just don't like to build such urls. cdrom600 on Jan 1, 2006 at 8:05:38 AM (# 9)OK. I'll be messing with this in the next few days/weeks, and I will see what I can do, what problems may arise, etc. Holophrastic on Jan 1, 2006 at 12:21:50 PM (# 10)Be careful:
Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo.
"messing" is not going to be easy. cdrom600 on Jan 1, 2006 at 2:13:31 PM (# 11) This message has been edited.Well, maybe not "messing", but definitely researching.
|