MyBB Community Forums

Full Version: What will happen if I rename ''Index.php''
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am just wondering what will happen if i rename the ''Index.php'' in my ftp ?
let's say i rename it to ''index2.php'' , if i go to www.mysite.com/index2.php it'll work ? Or i'll have an Error ?
It will work.

People that go to www.mysite.com will not see a webpage though - they will see the folder contents.

However changing it to index2.php may cause the people viewing that page to be in an "Unknown Location" on the who's online page. This is fixable though, do a search on the forums for adding custom pages or something.

Why do you want to do this?
Thanks bro i love ya Toungue
When renaming index.php you should be aware that there are several references to index.php in the mybb code

Just examples, there are probably more:
forumdisplay.php:			$location = "index.php";
global.php:$navbits[0]['url'] = $mybb->settings['bburl']."/index.php";
member.php:			redirect("index.php", $lang->redirect_registered);
member.php:			redirect("index.php", $lang->redirect_accountactivated);
member.php:		redirect("index.php", $lang->redirect_activationresent);
member.php:	redirect("index.php", $lang->redirect_lostpwsent);
member.php:			redirect("index.php", $lang->redirect_loggedin);
member.php:		redirect("index.php", $lang->redirect_alreadyloggedout);
member.php:	redirect("index.php", $lang->redirect_loggedout);
misc.php:		redirect("index.php", $lang->dst_settings_updated);
misc.php:		redirect("index.php", $lang->redirect_markforumsread);
misc.php:		redirect("index.php", $lang->redirect_forumpasscleared);
misc.php:	redirect("index.php", $lang->redirect_cookiescleared);
private.php:		header("Location: index.php");
usercp2.php:			$url = "index.php";

So expect links and redirections to go to index.php even if you renamed it to something else. If you do not have a index.php these things will result in 404 errors instead.
I should have remembered that - I renamed my portal just a few weeks ago.
Conclusion:
Index.php should not be renamed
If a different index is all you want, using the DirectoryIndex directive in .htaccess is the best way to go.

DirectoryIndex yourindex.php index.php index.html index.htm

instead of yourindex.php put the file you want to appear as index,

then http/yoursite/ would display that file and http/yoursite/index.php would still be the forum

and in all other dirs that only contain index.html, index.html would still be used (if there is no index.php or yourindex.php)
A MyBB setting to set the index.php to another filename would solve this problem, and should be considered for 1.6.
1.6 is feature frozen so it won't be included now.