Web Page Creation Question

Discussion in 'OT Technology' started by mrburner, Mar 21, 2005.

  1. mrburner

    mrburner Ron Paul 2008

    Joined:
    May 9, 2001
    Messages:
    7,448
    Likes Received:
    0
    Location:
    Phoenix
    I'm making a webpage in php...my main page will be index.php and it would be nice if people could just go straight to the root directory

    so basically i'm asking how can i make my index.html page automatically forward someone to my index.php page?
     
  2. Hoof

    Hoof 1@#)$(*@#)$(&)#$^*^@%#)*@ #%^*)(#% OT Supporter

    Joined:
    Nov 9, 2004
    Messages:
    4,474
    Likes Received:
    0
    Location:
    lulz
    delete move or rename index.html?
     
  3. mrburner

    mrburner Ron Paul 2008

    Joined:
    May 9, 2001
    Messages:
    7,448
    Likes Received:
    0
    Location:
    Phoenix
    what?

    look, if you go to a website such as www.whatever.com, you are automatically directed to the index.html file...my main page is coded in php...if i just have the index.php file in the directory, the webpage is not found (unless i go to www.whatever/index.php)...

    i've seen many pages that you go to and they automatically instantly redirect you to a different page...so can't i make an index.html page that automatically redirects to the index.php page when someone goes to the root of my site (i.e. www.whatever.com)
     
  4. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
    look up meta refresh tags
     
  5. billbixbysmonkey

    billbixbysmonkey more coffee please!!

    Joined:
    Mar 15, 2004
    Messages:
    50
    Likes Received:
    0
    You can set your index.php to be your default page.
     
  6. darkrick

    darkrick New Member

    Joined:
    Sep 17, 2004
    Messages:
    1,191
    Likes Received:
    0
    Location:
    Brisbane, AU
    If you don't need the index.html file just delete it :ugh:
     
  7. TV-MA

    TV-MA Guest

    right, just have your index.php instead of an index.html file.. I don't see why that would be a problem...
     
  8. badjasper

    badjasper Guest

    If you have access to your IIS Server then set your default document to index.php . If not, then make an index.html and use some script to redirect to your php page. Git-R-Done!
     
  9. TV-MA

    TV-MA Guest

    IIS :mamoru: hahaha use a real webserver..
     
  10. Keyzs

    Keyzs OT Supporter

    Joined:
    Nov 3, 2003
    Messages:
    814
    Likes Received:
    0
    Location:
    Charlotte, MI
    To do exactly what your asking:
    Code:
    <meta http-equiv="refresh" content="0;url=http://yourwebsite.com/index.php">
    
    The proper way, (assiming IIS 5 or 6)
    Right click my computer
    Select Manage
    Expand Services and Applications
    Select the web services used.
    Expand Websites (If listed)
    Right click default website (or the site you want to change if multiple)
    Select the Documents
    Add index.php and move to the top.
    Click Ok
    Close MMC

    Another trick (still not the right way but if you do not have control of the server will work) would be to change the name of the index.HTML to Index.asp and the content should be:
    Code:
    <% response.redirect("index.php") %>
    
    This is assuming the default INDEX.HTML and INDEX.ASP are in the documents listing.

    IIS works just fine as a webserver...
     
  11. mrburner

    mrburner Ron Paul 2008

    Joined:
    May 9, 2001
    Messages:
    7,448
    Likes Received:
    0
    Location:
    Phoenix
    thank you
     
  12. mrburner

    mrburner Ron Paul 2008

    Joined:
    May 9, 2001
    Messages:
    7,448
    Likes Received:
    0
    Location:
    Phoenix
    :uh: :nothelpfulorunderstandingthequestion:
     
  13. mrburner

    mrburner Ron Paul 2008

    Joined:
    May 9, 2001
    Messages:
    7,448
    Likes Received:
    0
    Location:
    Phoenix
    this is what i'm trying to do :hsugh: why is this question so difficult to understand
     
  14. mrburner

    mrburner Ron Paul 2008

    Joined:
    May 9, 2001
    Messages:
    7,448
    Likes Received:
    0
    Location:
    Phoenix
    this script is what i'm talking about to redirect...this is my question

    and i'm using apache, not iis
     
  15. mrburner

    mrburner Ron Paul 2008

    Joined:
    May 9, 2001
    Messages:
    7,448
    Likes Received:
    0
    Location:
    Phoenix
    i am
     
  16. mrburner

    mrburner Ron Paul 2008

    Joined:
    May 9, 2001
    Messages:
    7,448
    Likes Received:
    0
    Location:
    Phoenix
    thank you, i will try that code out tonight when i get home :bowdown: very helpful
     
  17. dk01

    dk01 Awwwwww..... OT Supporter

    Joined:
    Mar 1, 2005
    Messages:
    3,178
    Likes Received:
    0
    Location:
    All up in your interwebsnet.
    THE ABOVE WON'T WORK!

    I am assuming you are not hosting your own server (ie. you are paying for hosting) and therefore cannot change the Apache configuration. You should therefore use something called .htaccess

    The way to do this is:

    1. Create a file named htaccess.txt (on your windows machine)
    2. Put the following inside it:
    DirectoryIndex index.php
    3. Save and upload htaccess.txt to your root directory.
    4. On the webserver rename htaccess.txt to .htaccess (notice how there is no extension and remember the period at the beginning).

    Now delete index.html and index.php will be the default.

    -dk
     
  18. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,278
    Likes Received:
    555
    Even easier, then. No need to redirect. Just delete the index.html file.

    Then edit you httpd.conf (on my Fedora system it's /etc/httpd/conf/httpd.conf) and find the directive DirectoryIndex. Add index.php to the list, save, restart apache and go go go.
     
  19. Keyzs

    Keyzs OT Supporter

    Joined:
    Nov 3, 2003
    Messages:
    814
    Likes Received:
    0
    Location:
    Charlotte, MI
    Works just fine....
    He is using IIS not apache...
     
  20. Keyzs

    Keyzs OT Supporter

    Joined:
    Nov 3, 2003
    Messages:
    814
    Likes Received:
    0
    Location:
    Charlotte, MI
    Keep in mind the response.redirect is ASP and the page will need to be saved as ASP.
     
  21. dk01

    dk01 Awwwwww..... OT Supporter

    Joined:
    Mar 1, 2005
    Messages:
    3,178
    Likes Received:
    0
    Location:
    All up in your interwebsnet.
    Keyzs

    Did you read?

    -dk
     
  22. Keyzs

    Keyzs OT Supporter

    Joined:
    Nov 3, 2003
    Messages:
    814
    Likes Received:
    0
    Location:
    Charlotte, MI
    Shit, man don't listen to what I said.

    I did read, somehow missed that line several times... Blame it on Monday.
     
  23. dk01

    dk01 Awwwwww..... OT Supporter

    Joined:
    Mar 1, 2005
    Messages:
    3,178
    Likes Received:
    0
    Location:
    All up in your interwebsnet.
    Someone's got a case of the Mondays! :big grin:

    -dk
     
  24. Penguin Man

    Penguin Man Protect Your Digital Liberties

    Joined:
    Apr 27, 2002
    Messages:
    21,696
    Likes Received:
    0
    Location:
    Edmonton, AB
    Yep, assuming that the Apache server isn't setup by default to allow index.php as a default page (most are configured to allow that out of the box these days :dunno: ), that'll solve the problem.
     
  25. dk01

    dk01 Awwwwww..... OT Supporter

    Joined:
    Mar 1, 2005
    Messages:
    3,178
    Likes Received:
    0
    Location:
    All up in your interwebsnet.
    Yes I just figured that either way this will cover him :)

    -dk
     

Share This Page