The MU forums have moved to WordPress.org

Adding folders to /www/wp-content/blogs.dir/11/files/ (20 posts)

  1. awarner20
    Member
    Posted 16 years ago #

    I wasn't sure exactly how to word the title above. I'm hoping I can explain my question better.

    I am wondering if it is possible to install a standalone script on a per blog basis? I know I can do this with a plugin, but the one I'm talking about specifically is Associate-O-Matic. It creates an Amazon affiliate store and is managed via a web control panel.

    I am wondering if I would be able to install this into this directory, /www/wp-content/blogs.dir/11/files/

    Does this make sense to anyone?

  2. cafespain
    Member
    Posted 16 years ago #

    Hmm. Yes I think I understand what you mean. and I can honestly say I've never tried it. I would assume that if the directory has execute rights for the web user (which could be a security hole as it's also write-able) and you run the script using the blogs.dir path then it should run.

    You won't be able to run the script using the domain/files/ path though (again I am only guessing) as it opens the file before outputing it and it doesn't reach the php interpreter (but I may be very wrong on this point).

  3. cafespain
    Member
    Posted 16 years ago #

    Thinking on - the easiest way to test this would be to create a php file with just

    <?php phpinfo(); ?>

    in it, and see if it runs.

  4. awarner20
    Member
    Posted 16 years ago #

    Thanks for the reply...I'll just give it a whirl and see what happens.

    My ultimate goal would be to offer these as a free "upgrade" to my blog owners so they can configure their own stores relating to their blog subject.

  5. awarner20
    Member
    Posted 16 years ago #

    OK,

    I put the phpinfo file into:

    www/wp-content/blogs.dir/11/aom_test.php

    Then I went to this url:
    http://images.mysite.org/www/wp-content/blogs.dir/11/aom_test.php

    ...and I saw the PHP info:)

    Then I went to this directory:
    http://mysite.org/www/wp-content/blogs.dir/11/aom_test.php

    ...and also saw the PHP info:)

    So, I'm guessing that's good news:) I'll try and install of the AOM script and see what happens.

  6. awarner20
    Member
    Posted 16 years ago #

    OK, all installed and working as expected so far, except...the actual files reside here...

    http://images.mysite.org/wp-content/blogs.dir/11/shop.php

    ...and when I visit that url, I see the store as expected. However, I would the url to be more like this...

    http://images.mysite.org/shop.php

    Any thoughts on this?

  7. andrea_r
    Moderator
    Posted 16 years ago #

    Make a rewrite rule for it. :)

    I'd use the current htaccess file to see how it's done.

  8. awarner20
    Member
    Posted 16 years ago #

    Just to clarify, could this new rule be added to the current htaccess or would I need to create one in the same directory as noted above?

  9. cafespain
    Member
    Posted 16 years ago #

    You would add it to the main htaccess for the site - though don't ask me what it should be as I've killed more servers with my mod_rewrites than I care to mention.

  10. awarner20
    Member
    Posted 16 years ago #

    Ha! Thanks, I'll give it a shot although I just looked at the current rules and I'll have to study them a bit before making any additions;)

  11. lunabyte
    Member
    Posted 16 years ago #

    FYI: follow the theory of the rewrite for /files.

    Make it something like /shop, and then point it to use the main file, wherever you put it. Honestly, I'd probably move it out of the blogs.dir, and make it something else.

    With a proper rewrite in place, you would end up with something like domain/shop/, and working from there. Even though the file may physically be in /wp-content/blogs.shop/blog_id/shop.php. As a note, you "may" want to consider using the blog name (whatever, as in whatever.domain.tld), as that way you can save some processing to get the blog id.

  12. awarner20
    Member
    Posted 16 years ago #

    OK, after looking at this and reading up on rewrites, I am still confused. I understand how I can rewrite one file name to another, but if I am to accomplish this redirect for any of these AOM installs on any blog, I have no idea.

    Maybe I'll revisit this tomorrow. Thanks to you all for your help thus far...

  13. awarner20
    Member
    Posted 16 years ago #

    OK, I can't give it up. Can someone verify if I'm on the right track?

    RewriteRule ^shop.php$ /files/shop.php [L]

  14. lunabyte
    Member
    Posted 16 years ago #

    RewriteRule ^(.*/)?shop.php/(.*) wp-content/shop/shop.php?$2 [L]

    Should work, although I have no idea if there are other query string variables, or whatever. But that ought to get you in the ballpark.

  15. awarner20
    Member
    Posted 16 years ago #

    Thanks lunabyte,

    I have tried using:
    RewriteRule ^(.*/)?shop.php/(.*) wp-content/shop/shop.php?$2 [L]

    and then I tried...

    RewriteRule ^(.*/)?shop.php/(.*)wp-content/blogs.dir/11/shop.php?$2 [L]

    ...because that is the actual location of the file. Unfortunately, both of these didn't work.

    I want to clarify the ultimate goal and the location of the AOM folder and files. Upon a blog owner's request, I would like to add the following folders and files to a specific blog. It is my understanding that I need to add these files and folders in this location...
    http://ausersblog.example.com/wp-content/blogs.dir/11/AOM_FILES_AND_FOLDERS_HERE

    Here is a screenshot of how I have this installed on a blog with the id of 11, View Pic

    You can see that there is one folder called aom and three files, aom.php, admin.php, and shop.php. A user needs to have access to access to the admin.php file to configure their store, and the of course, the shop.php file needs to be accessible to all.

    So, as you can see, there is no shop folder. That's why I tried editing the suggested code into:

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

    This doesn't work, and I actually wouldn't expect it to since this is not accounting for either a specific blog id (11), or a blog id variable after the blogs.dir.

    Does this make any sense? Is what I'm trying to do impossible with Rewrite rules?

    Thanks for any further thoughts...

  16. lunabyte
    Member
    Posted 16 years ago #

    With my rule above, was there actually a file in the target location?

    The problem you'll get into with this would be the blog_id in the file path. You would have to have a rule for each blog. That, to me, would be more hassle than it's worth.

    A few things you could do, if you really wanted to upload and store it in their "files" directory, would be to point it to a file (just like it's done for /files, and blogs.php), but make a shop.php in the wp-content directory, get the blog id, and then do an include of the shop.php from there. To me, that would be more overhead than it's worth though.

    With a username available, you shouldn't have to fire up even a short init of MU, just to find out who it is.

    Since I'm not familiar with how/what you're using, there will be many things to consider with it.

    It may/may not be something you want to proceed with, and instead look to one of the WP plugins to get started instead.

    Not that it can't be done, it can, but you may have an easier time than you are now.

  17. awarner20
    Member
    Posted 16 years ago #

    Yes, there was a file in the target location for this rule:
    RewriteRule ^(.*/)?shop.php/(.*)wp-content/blogs.dir/11/shop.php?$2 [L]

    I think I'm going to put this one on the back burner. I see where the problem lies with the blog id, and you're right, that could get pretty labor intensive pretty quickly.

    Offering my users a way to create an entire Amazon associate store was the idea, but I suppose, when you get down to it, they can just create an aStore and link to it;)

    Thanks for all your help, I have learned a lot about Rewrite rules. By the way, here's an example of an AOM store...
    http://oneeyedview.com/mac_info/mac_store/shop.php

  18. lunabyte
    Member
    Posted 16 years ago #

    When in doubt, write a simple plugin. ;)

  19. awarner20
    Member
    Posted 16 years ago #

    Oh how I wish I could write one up lickity split...I wonder where I would find a plugin developer to hire to write such a plugin.

    I just did a search on their forums to see if a plugin existed, and found a thread that pointed the poster to one of my posts on how to integrate AOM with WordPress...how's that for full circle?

    http://wordpressmodder.org/should-you-add-a-store-to-your-wordpress-powered-website-42.html

  20. andrea_r
    Moderator
    Posted 16 years ago #

    Ha! :D Been there.

About this Topic

  • Started 16 years ago by awarner20
  • Latest reply from andrea_r