Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    113

    Ways to have a subfolder for a domain deliver content from another account's folder?

    What's the best way to have the content of the path of one account be delivered by a script on another account? For instance for example.com/sub1 to deliver content from /home/otherdir/public_html/other.php rather than from /home/example/public_html/sub1/.

    I've tried a simple include for a file rather than a folder (/sub1.php instead of /sub1), where for instance /home/example/public_html/sub1.php contains "include('/home/otherdir/public_html/other.php"), which works except for include path problems. If the other.php has it's own include there's an issue depending on how the include is handled - if other.php has "include('other2.php')" there's no issue, but if it uses the dot prefix "include('./other2.php')" I get failed to open stream: No such file or directory errors. Some scripts like Wordpress handle their includes with the dot prefix.

    I tried changing the include path in the example php script to one where the dot is explicitly specified
    PHP Code:
    set_include_path(get_include_path() . ":/home/otherdir/public_html/:/home/otherdir/public_html/."); 
    But that didn't help. I don't know if my straight include method is the right way to do this anyway.

    So what's the best approach for this type of thing?

  2. #2
    Join Date
    Mar 2009
    Location
    Austin Tx
    Posts
    2,007
    Try setting an Alias in your httpd.conf. Look at "cgi-bin" for an example.
    This is the best signature in the world....Tribute!
    (It is not the best signature in the world, no. This is just a tribute)

  3. #3
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    113
    Quote Originally Posted by mugo View Post
    Try setting an Alias in your httpd.conf. Look at "cgi-bin" for an example.
    Thanks

    I seem to be having issues with rewrite rules though. If I an Alias to httpd.conf for the account 'example'
    Code:
    Alias /sub1 /home/otherdir/public_html/
    That works, but if I place the following in the .htaccess for the example account
    Code:
    RewriteRule sub1/test test.php
    It just seems to ignore that rule - the rule doesn't get activated. If I use the same rule but without the "sub1/", then it works, so there's some conflict with the usage of alias. What's the proper way to add a rewrite rule when using an Alias?

  4. #4
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    113
    Does anyone know the correct way to integrate rewrite rules with Aliases?

Similar Threads

  1. 301 redirect root to subfolder as well as www to subfolder
    By Jaffery in forum SEO / SEM Discussions
    Replies: 5
    Last Post: 05-08-2012, 07:39 AM
  2. Some ways to improve the efficiency of your king content
    By MikePham in forum Web Design and Content Tutorials
    Replies: 1
    Last Post: 02-25-2012, 02:32 PM
  3. Redirect Your Whole Root Folder to a SubFolder
    By junitha in forum Hosting Security and Technology
    Replies: 0
    Last Post: 08-27-2008, 02:59 AM
  4. Problem: Account's domain names redirect on the root domain name
    By ultra2006 in forum Hosting Security and Technology
    Replies: 3
    Last Post: 04-27-2006, 09:20 AM
  5. any command to chmod folder & all subfolder
    By activa in forum VPS Hosting
    Replies: 6
    Last Post: 02-25-2006, 08:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •