help to translate rule

Topics: Developer Forum, User Forum
Mar 15, 2010 at 2:05 AM

Hi guys... can anybody assist to translate this rule for me in IIRF.ini?

The rewrite rule shown in .htaccess is :

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

 

Thanks! :)

Coordinator
Mar 15, 2010 at 11:56 AM

i don't think you need to translate it. it should just work.

Mar 15, 2010 at 12:40 PM
Edited Mar 16, 2010 at 1:05 AM

Pardon me for my lack of knowledge in all these rewrite rules because I am really new in it.

How I want the code to work is:

Whenever server is calling "http://blog.mydomain.com/files/2010/03/byl_big_b.jpg" ... it should be extracting contents from "wp-content\blogs.dir\1\files\2010\03\byl_big_b.jpg"

The full rules in my IIRF is shown below. 

RewriteRule ^/artists/(.*)$ – [L]
RedirectRule ^/([^.?]+[^.?/])$ /$1/ [R=301]

#uploaded files

RewriteRule ^(.*/)?files/$ index.php [L]
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

RedirectRule ^/index\.php/(.*)$ /$1 [I,R=301]
RewriteRule ^/(?!index\.php|wp-|xmlrpc)(.*)$ /index.php/$1 [I,L]

Coordinator
Mar 15, 2010 at 5:37 PM

you're gonna have to format that better.

Mar 16, 2010 at 1:06 AM

Hi Cheeso,

Sorry about that. I have reformat my entry.

:)

Coordinator
Mar 16, 2010 at 4:13 PM

But you don't have a rule for that.  I don't know about your site, or wordpress, but this rule:

  RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

... will rewrite your incoming url like http://blog.mydomain.com/files/2010/03/byl_big_b.jpg to wp-content/blogs.php?file=2010/03/byl_big_b.jpg

but I'm not sure that's what you want.  If you want a direct file reference, then you need to change that rule to be something more like this:

  RewriteRule ^(.*/)?files/(.*) wp-content/blogs.dir/1/files/$2 [L]

 

I suggest you try the TestDriver to figure out what your rules do, and compare them to what you want them to do.