Categories


Archives


Recent Posts


Categories


Invalid Base URL. Value must be a URL or one of placeholders: {{base_url}}

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

If you’re seeing the following error in Magento 2

Invalid Base URL. Value must be a URL or one of placeholders: {{base_url}}

The problem may the lack of a trailing slash on your base URLs

http://example.com
vs.
http://example.com/

There’s some questionable URL validation going on in

#File: app/code/Magento/Config/Model/Config/Backend/Baseurl.php
private function _isFullyQualifiedUrl($value)
{
    $url = parse_url($value);
    return isset($url['scheme']) && isset($url['host']) && preg_match('//$/', $value);
}

Although, to be fair “private” usually means

I don’t know how to do this so I’m going to hack something together that no one else will use and/or call.

So whatever poor overwowrked dev got this assignment has that going for him.

Copyright © Alana Storm 1975 – 2023 All Rights Reserved

Originally Posted: 10th December 2015

email hidden; JavaScript is required