SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,053
    Mentioned
    66 Post(s)
    Tagged
    1 Thread(s)

    Redirecting to a script outside the htdocs folder - is it possible?

    I currently use the following mod_rewrite after much pain and anguish that is set in the httpd.conf file of my server (not in .htaccess as is usual it seems).

    Code:
    # Rewrite Rules
    	RewriteEngine on
      
    # PAM handles all *.phtml files
    
    	RewriteRule ^(.*)\.phtml$ pamwf.php?PAMWF_PATH_QUERY=$1.phtml [L,QSA]  
      
    # PAM also handles any requests for non existant files and non-existant directory indexes.
    
    	RewriteCond %{REQUEST_FILENAME} !-f
    	RewriteRule ^(.*)$ pamwf.php?PAMWF_PATH_QUERY=$1 [L,QSA]
    Because of this code I have to place a "landing file" in the htdocs directory to receive the relevant path requests. I would prefer to redirect to a file outside the htdocs directory because my PHP scripts use the htdocs directory as an advanced cache forcing apache to do the grunt work on most pages I host without PHP's involvement when possible. The landing file does little more than include the main framework - and if I can be rid of it I can reduce my file read count.

    Can this be done?

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    MM,

    If the redirection page is accessible via http, then yes. HOWEVER, I get the sense that you want to be within your file structure but NOT within the webspace which is not possible.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,053
    Mentioned
    66 Post(s)
    Tagged
    1 Thread(s)
    Your intuition serves you well, that is the exact situation. Oh well, I'm stuck with the file so I guess I'll figure out a use for it.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    MM,

    If you need to keep the file out of direct access (out of the webspace), you could use a PHP script to read the file and output it - but the PHP script has to be in (or called from) the webspace, i.e., http://yadda-yadda.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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