You need to create a custom theme that inherits from Luma to be able to override the file correctly. Create the needed files:
app/design/frontend/{vendor_namespace}/{theme_name}/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/{vendor_namespace}/{theme_name}',
__DIR__
);
app/design/frontend/{vendor_namespace}/{theme_name}/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Your Custom Theme</title>
<parent>Magento/luma</parent>
</theme>
And then place your override here:
app/design/frontend/{vendor_namespace}/{theme_name}/Magento_Theme/templates/html/header.php
You then need to set your theme in the admin under Content -> Theme -> Configurations
Once the site is using your theme you will have the file override correctly. Note that you will have to replace all the default luma static blocks that are on the home page and category pages, the widgets that place them there are locked to the theme and will vanish when you switch this.
I also did a deeper write up on this: https://www.customerparadigm.com/magento-2-theming-basics/
luma_childtheme to not update the natif oneMagento_Lumathen you place your new file in :app/design/frontend/Magento/luma_child/templates/header.phtml– PЯINCƎ Mar 29 '18 at 20:18Magentovendor namespace in the app design folder, it's better to use your own namespace. There might be a time and place for it, but better to have it follow the magento standards. – circlesix Mar 29 '18 at 21:45