Magento2: Error page/maintenance page skin customisation is not currently possible

Created on 26 Apr 2016  路  13Comments  路  Source: magento/magento2

From what I can tell, the correct way to customise the default maintenance page is by adding a pub/errors/local.xml file & creating a new skin. It looks like there is a bug in this process.

In the _setSkin method in pub/errors/processor.php it first checks if the directory exists before setting the config to use the custom skin:

is_dir($this->_indexDir . self::ERROR_DIR . '/' . $value)

The problem lies in the variables setting up the path:

echo $this->_indexDir; // /var/www/src/pub/
echo self::ERROR_DIR; // pub/errors

Ending up with an incorrect path of:

/var/www/src/pub/pub/errors/custom_skin_name

It looks like either $this->_indexDir should be set to the Magento root (rather than the pub directory), or the ERROR_DIR const should not be prefixed with the pub dir.

Format is not valid Ready for Work bug report

Most helpful comment

Finished up by creating fake pub/pub/error/mymaintenance with readme inside.
Magento only checks if this folder exists and then takes the files from pub/error/mymaintenance as expected.

This also won't break when the fixed version will appear since it does not require any core updates.

All 13 comments

Thank you for reporting, we have created MAGETWO-52323 to investigate and fix.

Hi @mazhalai is there any update to this issue?

@danny-balance still being investigated.

This issue has been fixed and delivered to mainline.

Hi, when will this be released? This was fixed in a commit 9 months ago and is still not in a release.

@andimov
What release version the fix will be included into?

@sshymko it will be included into 2.2 release version

I have fixed it to change value of const ERROR_DIR in processor.php.
Removed pub from this const and only put errors like that const ERROR_DIR = 'errors' ;
I have tried it and it is working for me.

Finished up by creating fake pub/pub/error/mymaintenance with readme inside.
Magento only checks if this folder exists and then takes the files from pub/error/mymaintenance as expected.

This also won't break when the fixed version will appear since it does not require any core updates.

Be sure that your are in production mode. I wasn't able to see my custom in the developer mode.
It seems that the developer mode only print the exception, without to render the error with the default skin.

Still there in 2.1.10

Create the folder structure to fool the existence check
(Replace with your custom error theme name)

cd public

mkdir -p pub/errors/<theme>

touch pub/errors/<theme>/.htaccess

Note that you create a pub folder within the public folder

public/pub/errors/

Your public folder can be public_html

This error occurs when the magento2 folder is next to (or somewhere else then within) the public folder and you have symlinked the magento2/pub/* to public/ (and magento2/sitemap.xml to public/sitemap.xml etc.)

Just checked 2.2-develop, and didn't see any updates in this regards that might indicate this has been fixed.

@sankalp-prft: can you check the history of this file: https://github.com/magento/magento2/commits/2.2-develop/pub/errors/processor.php
Look at the commits on June 6 2016, those should fix this issue I believe.
You can also see those two same commits if you scroll up a bit on this very page, also to June 6 2016

If you believe it still isn't fixed, feel free to provide steps to reproduce on a clean installation.

Was this page helpful?
0 / 5 - 0 ratings