?
avatar LetMeRegister
LetMeRegister
23 Jan 2017

All URLs generated by Jommla have index.php/ inside them which will cause 404 Not found error.

Steps to reproduce:

  • Install Apache 2.4 & PHP-FPM 5.6
  • Install Jommla (latest version) with sample data (I used blog sample data)
  • You need MySQL too(I used MySQL 5.7)

If you go to a page like about your home page you will see that only HTML is loading and the rest of page is failing(404 Not found).

I dug into Joomla's source code and found out that problem is in libraries\joomla\uri\uri.php and a static function named base. When you browse the page I said, your URL will be like http://example.com/index.php/4-about-your-home-page. In that function you have a piece of code like this:

if (strpos(php_sapi_name(), 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI']))
{
	// PHP-CGI on Apache with "cgi.fix_pathinfo = 0"

	// We shouldn't have user-supplied PATH_INFO in PHP_SELF in this case
	// because PHP will not work with PATH_INFO at all.
	$script_name = $_SERVER['PHP_SELF'];
}
else
{
	// Others
	$script_name = $_SERVER['SCRIPT_NAME'];
}

After if, $script_name will be index.php/4-about-your-home-page and static::$base['path'] will be index.php instead of empty string.

  • php_sapi_name() === "fpm-fcgi"
  • $_SERVER['SCRIPT_NAME'] === 'index.php/4-about-your-home-page'
  • $_SERVER['PHP_SELF'] === 'index.php/4-about-your-home-page'

Screenshots:


HTML


ScreenShot


avatar LetMeRegister LetMeRegister - open - 23 Jan 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Jan 2017
avatar LetMeRegister LetMeRegister - change - 23 Jan 2017
The description was changed
avatar LetMeRegister LetMeRegister - edited - 23 Jan 2017
avatar LetMeRegister LetMeRegister - change - 23 Jan 2017
The description was changed
avatar LetMeRegister LetMeRegister - change - 23 Jan 2017
The description was changed
avatar LetMeRegister LetMeRegister - edited - 23 Jan 2017
avatar LetMeRegister LetMeRegister - change - 23 Jan 2017
The description was changed
avatar LetMeRegister LetMeRegister - edited - 23 Jan 2017
avatar LetMeRegister LetMeRegister - change - 23 Jan 2017
The description was changed
avatar PhilETaylor
PhilETaylor - comment - 4 Mar 2017

This is not a Joomla issue.

This is an incorrectly configured server.

avatar jeckodevelopment jeckodevelopment - change - 7 Mar 2017
The description was changed
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-03-07 10:48:47
Closed_By jeckodevelopment
avatar jeckodevelopment jeckodevelopment - close - 7 Mar 2017

Add a Comment

Login with GitHub to post a comment