Skip to content

Instantly share code, notes, and snippets.

@LeeSaferite
Created November 25, 2014 22:58
Show Gist options
  • Save LeeSaferite/30530ec6bb7f7ca68453 to your computer and use it in GitHub Desktop.
Save LeeSaferite/30530ec6bb7f7ca68453 to your computer and use it in GitHub Desktop.
Remove the index.php from admin URLs in Magento
<?php
class OpenMage_Base_Model_Core_Store extends Mage_Core_Model_Store
{
/**
* Add script file name to the URL if server rewrites are disabled or Magento is not installed
*
* NB: This differs from the parent just by not adding the script name to the URL for the admin site
*
* @param string $url
*
* @return string
*/
protected function _updatePathUseRewrites($url)
{
if (!$this->getConfig(self::XML_PATH_USE_REWRITES) || !Mage::isInstalled()) {
$indexFileName = $this->_isCustomEntryPoint() ? 'index.php' : basename($_SERVER['SCRIPT_FILENAME']);
$url .= $indexFileName . '/';
}
return $url;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment