rewrite (https and remove "~" tilde) help

Discussion in 'Apache' started by Jane Cua, Nov 5, 2015.

  1. #1
    I am using home_dir for my users to have their own area to host their group site. I want to use https instead of just http.

    My objective is to be able to do https and remove "~" tilde = https://myurl.com/jane

    I've added the following Rewrite Rules

    RewriteEngine On
    # this redirects from http to https
    RewriteCond %{HTTPS} !=on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    # This removes the tilde "~" from home dir url
    RewriteCond %{REQUEST_URI} ^/([^/]+)
    RewriteCond /home/%1 -d
    RewriteRule ^/([^/]+)(.*) /home/$1/public_html/$2

    With both rewrite there. I am able to do the following:
    https://myurl.com/~jane

    and
    https://myurl.com/jane
    Gives a 404 Not found

    - - -
    Not Found
    The requested URL /jane/ was not found on this server.
    - - -

    If I remove the Redirect for https.
    I am able to do
    http://myurl/jane

    But I want https://myurl.com/jane
     
    Jane Cua, Nov 5, 2015 IP