It looks like getenv returns a string (or false if the variable is not set, but it is in this case). So you need to cast the string to a boolean value to make it work. However, (bool)'false' gives true, not false. There are two possible solutions:
Set the variable to 0 instead of false in your .env file:
And then in your config:
Yes, possible. You just need to override the URL routing within the subdirectory, so requests to /sub/* get routed to /sub/index.php rather than /index.php.
For example, if you’re using Apache, just place Laravel’s .htaccess file within your subdirectory.
This can be done with a plugin.
The plugin would create an 'activity' table that saves the current user's ID and a timestamp of their last known activity.
You can insert the first row by listening to the onLogin event and remove their row by listening to the onLogout.
All subsequent requests, you'd compare the last known activity timestamp to the ...
There are various ways to go about this. Here’s a few:
Option 1: Keep each site completely contained
If you are able to keep each installation in its own directory, each with its own web root, that would be ideal, since you could develop and deploy each site individually:
If you're used to Local you can also use that for Craft.
Here's 2 articles to get you started:
I'm also hearing good things about https://ddev.readthedocs.io/en/stable/
Both the craft/ folder name in Craft 2, and the craft executable in Craft 3, can be renamed.
Since the craft executable is user-facing (when SSH’d in), I’d recommend leaving that alone and rename your craft/ folder to something else, maybe craft2/. Then in public_html/index.php, update your $craftPath variable to point to the new location:
$craftPath = '../...
The testToEmailAddress config setting which
Configures Craft to send all system emails to a single email address (or multiple email addresses), for testing purposes.
sounds like the one you are looking for.
Your /craft/config/social.php file should probably look like this:
'lockDomains' => [
If you wanted to add more config settings, that would look like this:
'lockDomains' => [
'allowEmailMatch' => false,
The problem is the ... in your contactform.php file.
The docs use it because they assume you might have some other valid config settings you want to include in that config file, but it's not real code, which is why PHP is choking on it.
Remove the ... and you should be set.
Im on Craft v3.4.25, and I've added the following event handler in my module to handle this. There are two scenarios here: either you want the new login to invalidate any existing session, or you want to block the new login if an active session exists.
If you want the new session to succeed, and log out any other sessions for that same user, you can do this:
As it turns out, I had made a configuration change that broke Craft's default behavior:
'defaultTemplateExtensions' => array('twig', 'xml')
All of Craft's internal templates use .html, and HTML templates are included in the default value of that config item. By overriding it, I had rendered Craft unable to find its stock error template.
Moral of the ...
In this situation you don't want to use a config file and instead you want to use plugin settings. The settings have a UI and save to the db, which does exactly what you want. The config files are meant to only be updated manually updating them.
The isSystemLive config setting isn't multi-site aware. It sets the entire Craft installation on or off, rather than per site, so you'll need to find a different method to disable domain2.com on the production server.
Untested, but you could try to set the baseUrl for domain2.com to an empty string on production and see if that works.
I wrote one of the articles about using Local and Craft that @erwinheiser mentioned above. I had enough trouble with Local over the years that I've since switched to Lando, which is an easy to use, cross-platform local development tool built on top of Docker. (No Docker experience necessary.) I use the built-in LAMP profile with Craft on a daily basis with ...
The advantage of Docker/Vangrant, etc. is they help create a server similar to production so you run into less issues when deploying. However, those setups are often overkill and complex especially if you don't collaborate on a team.
The good news is Craft is simply a LAMP application, like WP, so any stack that includes a web server like Apache or Nginx ...
You could have multiple independent Craft CMS installs in separate directories, or have a single Craft instance but use mulit-site to have different domains pointed to a single Craft install.
Sounds like a great use-case for Project Config!
It's a file-based representation of your site's settings and information architecture without the content.
Get your boilerplate Project Config setup, then copy the config/project files to a new site and use it as a starting point.
I think you're getting a few conventions mixed up.
Using an @ is typically reserved for aliases https://docs.craftcms.com/v3/config/environments.html#using-aliases-in-control-panel-settings
What you're probably looking for is environment variables in your .env file.
You could set:
Apparently, the answers are the following:
Redactor doesn't know how to output slugs/URIs instead of full URLs
Possibly a solution comes up with craft in the future
My API setup is suboptimal: In fact, I did set the baseUrl including the language: https://frontend.com/de. The recommendation is to not do that at the moment but keep one "Site" for all ...
If you are running Apache, you could set your ENVIRONMENT variable in your <VirtualHost> directive using SetEnv ENVIRONMENT "domain2" then have a section:
'domain2' => [
'isSystemLive' => false
In your config/general.php.
This error indicates that you don't have a matrix block, called header, setup in the CMS, but your template is expecting one.
The solution is to create a new matrix field;
settings > fields > new field.
The field type should be “matrix” and it's handle needs to be “header”.
Shameless plug: We've written a plugin that automatically updates your email settings depending on your environment. It's not free, but it is cheap :-) Please check out the page on our website for more information.
A further requirement came up to change the Italian output (symbol moved to after the price rather than before) so I opted for a simple Twig extension:
* Wrapper for Craft's NumberFormatter->formatCurrency
* Changes formats for French and Italian display
* @param $value
* @param string $currency
* @return string
public function ...