<IfModule mod_rewrite.c>
    RewriteEngine On

    # Canonical host: 301 anything that isn't the bare domain (e.g. www., v2.) to
    # non-www rentnumber.net. Skipped on localhost so the XAMPP preview still works.
    RewriteCond %{HTTP_HOST} !^(localhost|127\.0\.0\.1)(:\d+)?$ [NC]
    RewriteCond %{HTTP_HOST} !^rentnumber\.net$ [NC]
    RewriteRule ^(.*)$ https://rentnumber.net/$1 [R=301,L]

    # If request is not already for public/, rewrite it there internally.
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Options -Indexes

# Local XAMPP preview only: the cPanel handler above ("ea-php80") does not exist
# on this machine, so Apache would serve .php files as raw source. Restore the
# mod_php handler for localhost requests; production is untouched.
<If "%{HTTP_HOST} =~ /^(localhost|127\.0\.0\.1)(:\d+)?$/">
  <IfModule php_module>
    AddHandler application/x-httpd-php .php .php8 .phtml
  </IfModule>
</If>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php82” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php82 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
