Skip to main content

Config General

The config/general.php file in Craft CMS is where you can define global settings that apply to all environments (*), as well as environment-specific settings (like dev, staging, production). Below are the Overdog opinions on these settings, which are designed to optimize your Craft CMS project out of the box.

Global Settings

These settings apply to all environments unless overridden by environment-specific settings.

  • defaultWeekStartDay: Sets Monday as the start day of the week, which is common in many locales.
  • omitScriptNameInUrls: Configured to true, ensuring cleaner URLs by omitting "index.php".
  • cpTrigger: Sets the Control Panel access to '/admin', standardizing the access URL.
  • postLogoutRedirect: Adds a query parameter to the logout URL to trigger a notification message.
  • activateAccountSuccessPath: Adds a query parameter to the account activation URL to trigger a notification message.
  • securityKey: Pulls from an environment variable to set a unique key for hashing and encrypting data.
  • sameSiteCookieValue: Set to 'Lax' for broader compatibility with modern browsers while maintaining some level of CSRF protection.
  • backupOnUpdate: Disabled to prevent unnecessary backups during deployments, with the recommendation to handle backups through the database provider.
  • maxRevisions: Limits the number of entry revisions stored to 6, to avoid database bloat.
  • revAssetUrls: Enabled to ensure asset URLs are refreshed when assets change, aiding cache busting.
  • limitAutoSlugsToAscii and convertFilenamesToAscii: Ensures slugs and filenames contain only ASCII characters for consistency and compatibility.
  • defaultSearchTermOptions: Configures fuzzy search from both directions for all search forms in the site.
  • sendPoweredByHeader: Disabled to obscure the CMS being used, improving security through obscurity.
  • aliases: Defines path aliases used throughout the system, including AWS Cloudfront URLs if used.

Environment-Specific Settings

Development (dev)

  • devMode: Enabled for more verbose error reporting and other development features.
  • enableTemplateCaching: Disabled to ensure templates are reloaded on each request.
  • backupCommand and restoreCommand: Custom commands for database backups, can be tailored for environments like MAMP.

Staging (staging)

  • allowAdminChanges: Disabled to prevent changes to the site's settings or structure that could affect the production environment.

Production (production)

  • allowAdminChanges: Disabled to prevent changes to the site's settings or structure on the live site.
Reminder : Do not use the @web alias in your templates to avoid cache poisoning vulnerability.