0

I have a website that has a root html at index.html. I want to redirect index.html to a php file in a private folder one parent above to run an index.php. This file would then render the html content that I need depending on the request. How would I go about this process of getting the index.php from the index.html. The file structure looks like this:

private/
   -index.php

public_html/ 
   -index.html
andor kesselman
  • 1,089
  • 2
  • 15
  • 26
  • 1
    You need to have `index.php` somewhere that your webserver knows about, otherwise it cannot redirect. – Burhan Khalid Nov 03 '13 at 04:09
  • Isn't there a way to reference the file on the web server so that I can make everything in the public_html visible and public but everything in the private folder invisible? In other words, when I go to index.html I just want it to redirect to "../private/index.php". Why is this not possible? – andor kesselman Nov 03 '13 at 04:26
  • There is a way, but in order to set it up `private/index.php` needs to be somewhere that it mapped from your webserver so that it can make it "private" (that is, if someone browses http://yoursite.com/private/index.php they get a nasty error page). If it isn't inside your `DocumentRoot`, then there is nothing the webserver can do - it is effectively unreachable from the web. To keep it like you have and then load the contents of `private/index.php`, you would need to write _another_ script in `public_html`, but this is just creating a solution for a problem that doesn't exist. – Burhan Khalid Nov 03 '13 at 04:30
  • That is exactly what I ended up doing. It's not the most elegant solution but it works. Out of curiosity, do you care if someone sees your index.php file or generally is it not a concern? – andor kesselman Nov 03 '13 at 04:44
  • ??????? or you could even – iam-decoder Nov 03 '13 at 08:11

1 Answers1

1

Try to use this meta code in your index.html

 <meta http-equiv="Refresh" content="0; url=/private/index.php">

It's an html redirection actually.

If this doesn't work, try to hook in htaccess

ElvinD
  • 667
  • 1
  • 7
  • 10
  • I didn't work. I found a small and ugly work around. I use the html and redirect using the tag to a direct.php which then loads the private index php. It's not the prettiest but it works. Thanks for the help. – andor kesselman Nov 03 '13 at 04:37