Help with ReWrite

Discussion in 'Apache' started by New World Man, May 19, 2022.

  1. #1
    I think what I need is an exact match only ReWrite...
    I am self-hosting, and changing to all https:// instead of http://
    It seems to all be working withe the exception of the main page, if is fine if you specify index.html, but without it, locally I get router settings login, that is regardless of if http:// or https:// is used to call it. So basically
    https://domain.net/index.html (or http://domain.net/index.html)
    Code (markup):
    works fine, but
    http://domain.net
    Code (markup):
    does not. Any other index file in a different folder in the server directory has no problem weather index.html is specified or not.

    I already have in the file 000-default.conf settings that will replace any url starting with http:// to https:// and it works fine.
    So my thought (unless someone has another idea) is somehow check for an exact url match before the change from http:// to https:// looking for either one domain.net or domain.net/ and if that is true, with NOTHING else after it, change it to domain.net/index.html

    What I have so far sure does change from http:// to https:// no problem, but no luck at all attempting to add the /index.html ONLY if just domain.net is the given url.
    
      RewriteEngine On
    
       RewriteCond %{HTTPS} !=on
       RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
    
    Code (markup):
     
    New World Man, May 19, 2022 IP