1. Magento 2 'Home Page'

throws "Invalid Document Element 'type': Character content other than whitespace is not allowed because the content type is 'element-only'" in developer mode

but it's coming fine in production mode.

All other pages (such as http://example.com/admin, http://example.com/contact, http://example.com/catalogsearch/advanced/ ) gives 404 error in both developer and production mode.

Note : above such are done with 'var' and 'pub' directories recursively given 777 permission.

  1. It also gives "SOAP-ERROR: Parsing WSDL: Couldn't load from....." may be because of the same issue.

Though SOAP is enabled, IP in host file is okay but SOAP connection gets failed.


I already followed the solutions given in magento forums and stackoverflow, stackexchange.. etc, But the problem still persists.

2 Answers 2


The issue has been solved by following the below steps:

  1. i. applying proper permissions, ii. enable apache rewrite_module iii. refresh apache server.

    sudo chmod -R 777 /var/www/html/MAGENTO_2_ROOT_DIRECTORY/ sudo a2enmod rewrite sudo service apache2 restart

  2. run following command from Magento root:

    php bin/magento setup:static-content:deploy

  3. Now clear var directory except .htaccess file and check admin. If still the issue persists, then it may be because of Symlink. For this, Edit apache config file

    sudo gedit /etc/apache2/apache2.conf

and replace this code :

Options Indexes FollowSymLinks AllowOverride none Require all granted


<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

Note: changed AllowOverride none to AllowOverride All

Now restart apache sudo service apache2 restart and check admin. This should fix admin 404 issue.

  1. Also make sure, you don't leave /app/etc/ directory writable

I believe the problem comes from the xml of a theme or a module. The fact that it "works fine" in production mode is just that the errors are not displayed but logged (var/log/ most probably or var/report/).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.