diff --git a/check_process b/check_process index dac7494..f8eeef1 100644 --- a/check_process +++ b/check_process @@ -20,7 +20,7 @@ multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels Level 1=auto Level 2=auto diff --git a/scripts/change_url b/scripts/change_url index 13ddd0b..e19b82f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -95,7 +95,21 @@ fi application_file="$final_path/app/data/_data_/_default_/configs/application.ini" ynh_replace_string "default_domain = .^" "default_domain = \"$new_domain\"" "$application_file" -ynh_replace_string "$old_domain$old_path" "$new_domain$new_path" "$final_path/index.php" +if [ $old_path = "/" ] && [ $new_path = "/" ] +then + ynh_replace_string "$old_domain" "$new_domain" "$final_path/index.php" +elif [ $old_path != "/" ] && [ $new_path != "/" ] +then + ynh_replace_string "$old_domain$old_path" "$new_domain$new_path" "$final_path/index.php" +elif [ $old_path != "/" ] && [ $new_path = "/" ] +then + ynh_replace_string "$old_domain$old_path" "$new_domain" "$final_path/index.php" +elif [ $old_path = "/" ] && [ $new_path != "/" ] +then + ynh_replace_string "$old_domain" "$new_domain$new_path" "$final_path/index.php" +else + ynh_die "Error changing the URL" +fi #================================================= # GENERIC FINALISATION