MyBB Community Forums

Full Version: Renaming index.php links
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So the other day I resently renamed my index.php to forums.php. Now, I noticed a couple things that really did not make me so happy, and that is when viewing online.php I noticed that all members and guest where viewing a Unknown Location, when really they were looking at the index, which I renamed to forums.php.

Here is a screen shot: http://gyazo.com/0dae466a718206e39d13517a14fff42d

So my question is how can I fix that, and rename all the index.php links, to forums.php?

Thanks Smile
First of all its a bad idea renaming the script.
But if you at all doing this; may be there are many things to change (investigation / experience required). But the first step; I can say is:

open the script, find this:

define('THIS_SCRIPT', 'index.php');

and change it to:

define('THIS_SCRIPT', 'forums.php');
(2014-01-29, 07:03 AM)effone Wrote: [ -> ]First of all its a bad idea renaming the script.
But if you at all doing this; may be there are many things to change (investigation / experience required). But the first step; I can say is:

open the script, find this:

define('THIS_SCRIPT', 'index.php');

and change it to:

define('THIS_SCRIPT', 'forums.php');

Alright thanks. I have another question, and that would be why is it a bad idea to rename the script?
If the index.php is specified in any class or function (not sure) or hardcoded in any other code chunk in any script you have to make changes over there also else that particular function, class or script will fail to work.

and if you finally manage everything working properly; that also will lead you to hard times during upgrade.
(2014-01-29, 07:48 AM)effone Wrote: [ -> ]If the index.php is specified in any class or function (not sure) or hardcoded in any other code chunk in any script you have to make changes over there also else that particular function, class or script will fail to work.

and if you finally manage everything working properly; that also will lead you to hard times during upgrade.


I knew it would relate in something like this. However, for what I am trying to do, it should not be a big deal. For more of the matter of "Forking", then
it should not cause a big deal.
For users online, edit /inc/functions_online.php.
A little bit of searching shows this thread.
(2014-01-29, 07:03 AM)effone Wrote: [ -> ]and change it to:

define('THIS_SCRIPT', 'forums.php');

Don't do that. It does not fix anything and breaks plugins that expect THIS_SCRIPT == index.php for the index page, no matter what the file is actually called.

You don't have to rename index.php just because you want a different index page; you can just make it use a different file for the index, using .htaccess DirectoryIndex

DirectoryIndex home.php index.php index.html

That would make it use home.php before index.php before index.html, so if you put a home.php in your / then that's what it will show.

If you want to rename your index.php then anyway, instead of changing all hundred occurences of it in the MyBB code, use a redirect:

RewriteRule ^home\.php$ http://yoururl/ [L,QSA,R=301]
RewriteRule ^index\.php$ http://yoururl/forum.php [L,QSA,R=301]