qadenza
qadenza

Reputation: 9293

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, i.e. - 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"

Upvotes: 0

Views: 472

Answers (1)

D4V1D
D4V1D

Reputation: 5849

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" )

Upvotes: 1

Related Questions