diff --git a/create_vhost.sh b/create_vhost.sh index c7b7049..5e20263 100755 --- a/create_vhost.sh +++ b/create_vhost.sh @@ -273,10 +273,10 @@ CREATE_SYMLINK_WEB_BASE_DIR=false # --- script_base_dir="$(realpath $(dirname $0))" -conf_file="${script_base_dir}/conf/create_vhost_php.conf" +conf_file="${script_base_dir}/conf/create_vhost.conf" echo "" -echononl "\tInclude Configuration file.." +echononl "\tInclude Configuration file '$conf_file'.." if [[ ! -f $conf_file ]]; then echo_skipped else @@ -2042,8 +2042,16 @@ EOF RewriteEngine on RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/ +EOF + if $_https_only ; then + cat <> ${_new_vhost_config_file} + RewriteRule (.*) https://${rewrite_url} [R=301,L] +EOF + else + cat <> ${_new_vhost_config_file} RewriteRule (.*) http://${rewrite_url} [R=301,L] EOF + fi if [ -n "$_custom_ip_log" ]; then cat <> ${_new_vhost_config_file} @@ -2834,7 +2842,6 @@ fi for _alias in "${_server_aliases_arr[@]}" ; do cat <> ${_new_vhost_config_file} # --- $_alias - EOF if [ "$?" != "0" ]; then _failed=true @@ -2842,10 +2849,12 @@ EOF done if [ "$_ipv6" != "disabled" ]; then cat <> ${_new_vhost_config_file} + EOF else cat <> ${_new_vhost_config_file} + EOF fi