We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to define default base path and base URL during migration?

News and General

Matahi's avatar
Matahi
29 posts
3 months ago
Matahi's avatar Matahi

Hi everyone,

I’m currently in the process of migrating an ExpressionEngine site (v7.5.13), and I’m not sure how to properly define the Default Base Path and Default Base URL for my environment.

When I try to set them, I keep getting the warning:

This path is either invalid or not writable.

I want to make sure my setup works for different environments (local, staging, production) without hardcoding absolute paths, but I’m not clear on the best way to configure:

Default base path (server filesystem path)

Default base URL (public URL for assets/themes)

👉 What’s the recommended way to set these up so the migration goes smoothly and the paths resolve correctly across environments?

Thanks in advance for any guidance!

       
Russ K.'s avatar
Russ K.
174 posts
3 months ago
Russ K.'s avatar Russ K.

Hi.
I always do this in the config.php file.

These 2 lines will take care of it:

$config[‘base_url’] = ‘YOUR_URL’;

$config[‘base_path’] = ‘YOUR_PATH’;

Hope that helps.

R

🤗 1
       
Brian Litzinger's avatar
Brian Litzinger
704 posts
3 months ago
Brian Litzinger's avatar Brian Litzinger

You’ll likely want to set the variables in your config.php file, e.g.

$config['base_url'] = 'https://mysite.com/';
$config['base_path'] = '/var/www/html/public_html/';

The best option is to use the .env.php file, and set it in there:

BASE_URL=https://mysite.com/
BASE_PATH=/var/www/html/public_html/

Then your config.php would look like this, and its the most portable between environments because you can commit your config.php file to Git, and just update the .env.php file in each environment.

$config['base_url'] = $_ENV['BASE_URL'];
$config['base_path'] = $_ENV['BASE_PATH'];

There are other values that can extend those too. Setting these isn’t required, I think EE handles setting the defaults based on your base_url and base_path config, but if you do need to tweak these this is how you can do it.

$config['tmpl_file_basepath'] = $config['base_path'] . 'templates/';
$config['theme_folder_path']  = $config['base_path'] . 'themes/';
$config['theme_folder_url'] = $config['base_url'] .'themes/';
$config['captcha_path'] = $config['base_path'] . 'images/captchas/';
$config['captcha_url']  = $config['base_url'] . 'images/captchas/';
$config['emoticon_url'] = $config['base_url'] . 'images/smileys/';
$config['emoticon_path'] = $config['base_path'] . 'images/smileys/';
$config['avatar_path'] = $config['base_path'] . 'images/avatars/';
$config['avatar_url'] = $config['base_url'] . 'images/avatars/';
$config['photo_path'] = $config['base_path'] . 'images/member_photos/';
$config['photo_url'] = $config['base_url'] . 'images/member_photos/';
$config['sig_img_path'] = $config['base_path'] . 'images/signature_attachments/';
$config['sig_img_url'] = $config['base_url'] . 'images/signature_attachments/';
$config['prv_msg_upload_path'] = $config['base_path'] . 'images/pm_attachments/';
$config['prv_msg_upload_url'] = $config['base_url'] . 'images/pm_attachments/';
$config['board_upload_path'] = $config['base_path'] . 'images/forum_attachments/';
$config['board_upload_url'] = $config['base_url'] . 'images/forum_attachments/';
🤗 1
       
Matahi's avatar
Matahi
29 posts
about 3 months ago
Matahi's avatar Matahi

Thank you very much, Brian and Russ.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.