简体   繁体   中英

index.php is not loaded by default

my address is " http://www.dopsfest.com ".

Written this way it shows javascript file (index.js)

If I add "/index.php" to the address - it is displayed correctly, ie - index.php is loaded.

I tried with php:

$address = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$stack = explode('/', $_SERVER["REQUEST_URI"]);
$file = array_pop($stack);
$folder = array_pop($stack);
if ($file =="") {header('Location: http://www.dopsfest.com/index.php');}

without success.

Why I need to write "index.php" ?
In localhost and on another remote server, it works without adding "index.php"

Apache

Create a .htaccess file under the root of your project and put this:

DirectoryIndex index.php

Nginx

$ cd /etc/nginx/sites-available/default

Index index.html index.htm, index.php;

Lighttpd

$ nano /etc/lighttpd/lighttpd.conf

index-file.names = ( "index.php", "index.html" )

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