Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 11 Years ago Renaming index.php links
#1
Solved: 11 Years ago
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
#2
Solved: 11 Years ago
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');
#3
Solved: 11 Years ago
(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?
#4
Solved: 11 Years ago
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.
#5
Solved: 11 Years ago
(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.
#6
Solved: 11 Years ago
For users online, edit /inc/functions_online.php.
#7
Solved: 11 Years ago
A little bit of searching shows this thread.
#8
Solved: 11 Years ago
This user has been denied support. This user has been denied support.
(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]


Forum Jump:


Users browsing this thread: 1 Guest(s)