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

# Redirect from /create to /create_short_link.php with the query parameters intact
<IfModule mod_rewrite.c>
  RewriteEngine On

  # Case 1: If the request is directly to the domain without any path or ID (like https://w.squizeepay.in/)
  # do nothing (no redirection)
  RewriteCond %{REQUEST_URI} ^/$
  RewriteCond %{QUERY_STRING} ^$  # No query string (just domain)
  RewriteRule ^$ - [L]

  # Case 2: If the path is /create, do not redirect (ignore it)
  RewriteCond %{REQUEST_URI} ^/create$
  RewriteRule ^create$ - [L]

  # Case 3: Match /create and redirect to /create_short_link.php with the query parameters intact
  RewriteCond %{QUERY_STRING} ^url=(.*)&email=(.*)&format=(.*)&suffix=(.*)$
  RewriteRule ^create$ /create_short_link.php?url=%1&email=%2&format=%3&suffix=%4 [L,R=301]

  # Case 4: If there is a path (suffix or ID), redirect from w.squizeepay.in to s.squizee.in
  RewriteCond %{HTTP_HOST} ^w\.squizeepay\.in$ [NC]
  RewriteCond %{REQUEST_URI} ^/([^/]+)$  # Path exists (non-empty path)
  RewriteRule ^(.*)$ https://s.squizee.in/$1 [L,R=301]
</IfModule>
