diff --git a/README.md b/README.md
index c7cac0a..ea57634 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[](https://install-app.yunohost.org/?app=monica)
-**Shipped version: v2.3.0**
+Shipped version: **v2.3.1**

Personal Relationship Manager
@@ -36,6 +36,7 @@ Monica is an open-source web application to organize the interactions with your
* [X] Backup and restore script (**Need testing**)
* [X] Multi-instance (**Need testing**)
* [x] make root domain redirect to index.php
+* [x] Chang URL (Need testing,backup before trying this)
* [ ] LDAP/SSO support
* [ ] Make monica installable into subdirectory (eg. https://example.com/monica/)
* Currently it is only possible to install monica into the root of a domain (eg. https://example.com/)
diff --git a/conf/app.src b/conf/app.src
index e1a94c4..7c9734c 100644
--- a/conf/app.src
+++ b/conf/app.src
@@ -1,6 +1,6 @@
-SOURCE_URL=https://github.com/monicahq/monica/archive/v2.3.0.zip
-SOURCE_SUM=aed382d467aacaa31fde88d4cceae622a78f3e8f6a00f6db27977b41fbad0576
+SOURCE_URL=https://github.com/monicahq/monica/archive/v2.3.1.zip
+SOURCE_SUM=d18a2ad59937d5a053727336a03402557a774c148060f060cf45f6c686596b90
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
-SOURCE_FILENAME=v2.3.0.zip
+SOURCE_FILENAME=v2.3.1.zip
diff --git a/manifest.json b/manifest.json
index fc2a2bb..d049da9 100644
--- a/manifest.json
+++ b/manifest.json
@@ -7,7 +7,7 @@
},
"url": "https://monica.com",
"license": "GPL-3.0",
- "version": "2.3.0",
+ "version": "2.3.1",
"maintainer": {
"name": "Sebastian Gumprich",
"email": "yunohost@gumpri.ch",
diff --git a/scripts/change_url b/scripts/change_url
new file mode 100644
index 0000000..49bf241
--- /dev/null
+++ b/scripts/change_url
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+#=================================================
+# GENERIC STARTING
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+source _common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# RETRIEVE ARGUMENTS
+#=================================================
+
+old_domain=$YNH_APP_OLD_DOMAIN
+old_path=$YNH_APP_OLD_PATH
+
+new_domain=$YNH_APP_NEW_DOMAIN
+new_path="/"
+
+app=$YNH_APP_INSTANCE_NAME
+final_path=$(ynh_app_setting_get $app final_path)
+
+#=================================================
+# CHECK THE SYNTAX OF THE PATHS
+#=================================================
+
+test -n "$old_path" || old_path="/"
+test -n "$new_path" || new_path="/"
+new_path=$(ynh_normalize_url_path $new_path)
+old_path=$(ynh_normalize_url_path $old_path)
+
+#=================================================
+# CHECK WHICH PARTS SHOULD BE CHANGED
+#=================================================
+
+change_domain=0
+if [ "$old_domain" != "$new_domain" ]
+then
+ change_domain=1
+fi
+
+change_path=0
+if [ "$old_path" != "$new_path" ]
+then
+ change_path=1
+fi
+
+#=================================================
+# STANDARD MODIFICATIONS
+#=================================================
+# MODIFY URL IN NGINX CONF
+#=================================================
+
+nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
+
+# Change the path in the nginx config file
+if [ $change_path -eq 1 ]
+then
+ # Make a backup of the original nginx config file if modified
+ ynh_backup_if_checksum_is_different "$nginx_conf_path"
+ # Replace locations starting with old_path
+ # Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location)
+ ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? $old_path" "location\1 $new_path" "$nginx_conf_path"
+ # Replace path in "return" directives
+ ynh_replace_string "return \([[:digit:]]\{3\}\) $old_path" "return \1 $new_path" "$nginx_conf_path"
+ # Calculate and store the nginx config file checksum
+ ynh_store_file_checksum "$nginx_conf_path"
+fi
+
+# Change the domain for nginx
+if [ $change_domain -eq 1 ]
+then
+ # Delete file checksum for the old conf file location
+ ynh_delete_file_checksum "$nginx_conf_path"
+ mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
+ # Store file checksum for the new config file location
+ ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
+fi
+
+#=================================================
+# SPECIFIC MODIFICATIONS
+#=================================================
+# Run monica update
+cd $final_path && sudo /usr/bin/php7.1 artisan monica:update --force
+
+#=================================================
+# GENERIC FINALISATION
+#=================================================
+# RELOAD NGINX
+#=================================================
+
+systemctl reload nginx
diff --git a/scripts/install b/scripts/install
index 9b034d0..6c3bf01 100755
--- a/scripts/install
+++ b/scripts/install
@@ -176,3 +176,5 @@ fi
#=================================================
systemctl reload php7.1-fpm
systemctl reload nginx
+# Set default php to php7.0
+update-alternatives --set php /usr/bin/php7.0
diff --git a/scripts/restore b/scripts/restore
index 0c74905..0bd7b89 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -115,3 +115,5 @@ ynh_restore_file "/etc/cron.d/$app"
systemctl reload php7.1-fpm
systemctl reload nginx
+# Set default php to php7.0
+update-alternatives --set php /usr/bin/php7.0
diff --git a/scripts/upgrade b/scripts/upgrade
index c788718..3d0c778 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -147,3 +147,5 @@ fi
#=================================================
systemctl reload nginx
+# Set default php to php7.0
+update-alternatives --set php /usr/bin/php7.0