简体   繁体   中英

My website doesn't load index.php automatically, instead it loads the router login page: mysite/cgi-bin/login.cgi

I have a live project placed on my server at home running Ubuntu 12.04.1, but when I go to the website URL from another router(out of LAN which has the project server): www.mysite.com, then I get directed to the router page which is: mysite/cgi-bin/login.cgi with a note: "page not found". mysite.com/index.php is working fine!

I have edited sites-available for mysite.com and added DirectoryIndex as below

<Directory />
    DirectoryIndex index.php
</Directory>


<Directory /var/www/mysite>
     DirectoryIndex index.php
</Directory>

I also tried adding "DirectoryIndex index.php" in .htaccess file which locates in the mysite folder with no luck.

Restarted Apache2 many times!

Would you please hint me on this?

Thank you!

Have you tried to specify a page when no other is selected like this? This is what I have on my index.php page:

 <?php
    $page_ID = "";
    if(isset($_GET['pageID'])) $page_ID = $_GET['pageID'];      
?>



 <div id="content">
            <?php 
                $page_ID = "";
                if(isset($_GET['pageID'])) $page_ID = $_GET['pageID'];

                if( $page_ID == "ContactMe" ) {
                        include("ContactMe.php");
                } 
                elseif( $page_ID == "Default" || $page_ID=="") {
                        include("Default.php"); //DEFAULT PAGE WHEN "page" NOT SPECIFIED      
                }
            ?>
 </div>

Also, on every other page, I put something like this as a header to set the $page_ID:

<?php 
if (isset($_GET["pageID"]) && $_GET["pageID"]=="ContactMe"):
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM