MyBB Community Forums

Full Version: Can we remove index.php after the domain name ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2023-06-15, 08:52 PM)jkcool Wrote: [ -> ]Only Theme Selector index issue is remaining.

Try replacing line 5465 of inc/functions.php:
	if(!empty($_SERVER['SCRIPT_NAME']))
with:
	$location = false;
	if(!empty($_SERVER['REQUEST_URI']))
	{
		$https = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
		$scheme = $https ? 'https://' : 'http://';
		$script_loc = $scheme.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
		if(explode($mybb->settings['bburl'], $script_loc) == array('', '/index.php'))
		{
			$location = htmlspecialchars_uni(substr($_SERVER['REQUEST_URI'], 0, -strlen('/index.php')));
		}
	}
	if($location === false)
	{
		// Do nothing - $location was already set above.
	}
	elseif(!empty($_SERVER['SCRIPT_NAME']))

If that works, then the core edit plugin referenced by Taylor above might help to maintain it across MyBB ugrades.


I have done that but website and admin panel showing white blank page and when I redit the code its still showing website and admin panel white blank page.

Edit: It dosent worked and I have fixed my website aswell from white blank page.
If you need to reset the contents of that inc/functions.php file, and you're running MyBB 1.8.34, then you can save this file over it:

https://raw.githubusercontent.com/mybb/m...ctions.php

As for why you got that white blank page in the first place, I don't know.
for me it works well and the code gave by Laird is working fine
(2023-06-17, 02:36 AM)PARADOX987 Wrote: [ -> ]for me it works well and the code gave by Laird is working fine

Unfortunately, though, it was buggy, but often enough just "happened to work". Here's code which hopefully this time is working:

(2023-06-15, 08:52 PM)jkcool Wrote: [ -> ]Only Theme Selector index issue is remaining.

Try replacing line 5465 of inc/functions.php:
	if(!empty($_SERVER['SCRIPT_NAME']))
with:
	$location = false;
	if(!empty($_SERVER['REQUEST_URI']))
	{
		$https = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
		$scheme = $https ? 'https://' : 'http://';
		$script_loc = $scheme.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
		$a = explode($mybb->settings['bburl'], $script_loc);
		if(count($a) == 2 && $a[0] == '')
		{
			if($a[1] == '/' || $a[1] == '/index.php')
			{
				// The + 1 is so we leave the trailing slash in case it's the only
				// character left after removing 'index.php' - otherwise, in that
				// scenario, we'd be left with an empty location, which would default
				// to reloading the current URL, which would use 'index.php'.
				$location = htmlspecialchars_uni(substr($_SERVER['REQUEST_URI'], 0, strlen($_SERVER['REQUEST_URI']) - strlen($a[1]) + 1));
			}
		}
	}
	if($location !== false)
	{
		// Do nothing - $location was already set above.
	}
	elseif(!empty($_SERVER['SCRIPT_NAME']))
Pages: 1 2