1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Different default start page

Discussion in 'Programming' started by schlottke, Mar 4, 2005.

  1. #1
    Say I have an /index.php and /otherpage.php,

    I want to have otherpage.php load when you go to

    http://www.mydomain.com/ rather than having /index.php load.

    What would I do in order to make this possible, without a redirect now, I want the index to load otherpage.php as the main page.
     
    schlottke, Mar 4, 2005 IP
  2. Lindsay

    Lindsay Guest

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In my case, I just contacted my host and asked them to make the change.
     
    Lindsay, Mar 4, 2005 IP
  3. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #3
    In your .htaccess file:
    DirectoryIndex filename.html
    Code (markup):
     
    ResaleBroker, Mar 4, 2005 IP
  4. Such Great Heights

    Such Great Heights Peon

    Messages:
    715
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can also do this:
    DirectoryIndex otherpage.php index.php index.html
    Code (markup):
    This way when you get rid of, or rename the otherpage.php it will default to index.php, and if index.php isn't there it will default to index.html. And of course you could keep on adding files. :)

    Your .htaccess file is in your root web directory .. ie. where you have this index.php and otherpage.php.
     
    Such Great Heights, Mar 4, 2005 IP
  5. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #5
    And just to complete this thread, It you don't want to use the .htaccess or httpd.conf files (or you don't use apache), you can use php to do a simple redirect:

    index.php
    
    <?php
    	header( 'HTTP/1.1 301 Moved Permanently' );
    	header( 'Location: http://'.$_SERVER['HTTP_HOST'].'/startpage.php' );
    ?>
    PHP:
     
    exam, Mar 5, 2005 IP
  6. Agent47

    Agent47 Well-Known Member

    Messages:
    775
    Likes Received:
    138
    Best Answers:
    0
    Trophy Points:
    135
    #6
    or maybe in your index.php fileyou can write
    <?php include("otherpage.php"); ?>
    PHP:
     
    Agent47, Mar 5, 2005 IP