greece57
greece57

Reputation: 421

My webpage is redirecting me to /defaultsite instead of index.php

After moving the rootDirectory of apache2 from

/var/www/html

to

/var/www/html/MyFolder

because I didn't want my website to be "www.website.de/MyFolder" but now I have to type in "www.website.de/index.php" (that works)

What do I have to change so I can just type in "www.website.de" and the index.php is displayed automatically

I didn't change much. Only the rootDirectory 000-default.conf.

Upvotes: 0

Views: 2418

Answers (2)

greece57
greece57

Reputation: 421

I had changed the DNS Nameservers recently but my browser is still redirecting me to the old DNS servers. I found that out because on my phone everything is working perfectly.

I tried everything - from clearing browser cache to ipconfig /flushdns but nothing worked until now - maybe somebody has an idea how I can fix this problem on my machine?

Upvotes: 0

user2493235
user2493235

Reputation:

Add this:

DirectoryIndex index.php index.html index.htm

Or just:

DirectoryIndex index.php

If you don't care about index.html and index.htm being possible alternatives.

This tells Apache which files should be served from a directory when no file is specified, in order of priority.

Perhaps put it in a .htaccess file in MyFolder.

Upvotes: 1

Related Questions