RewriteEngine On
RewriteBase /AdminxX/update/

# Route "/users/{id}" to "users.php?id={id}"
RewriteRule ^users/([0-9]+)/?$ users.php?id=$1 [L,QSA]

# Route "/products/{id}" to "products.php?id={id}"
RewriteRule ^products/([0-9]+)/?$ products.php?id=$1 [L,QSA]

# Route "/gateways/{id}" to "gateways.php?id={id}"
RewriteRule ^gateways/([0-9]+)/?$ gateways.php?id=$1 [L,QSA]

# Fallback: If the file doesn't exist, route to either users.php or gateways.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/AdminxX/update/users [NC]
RewriteRule .* users.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/AdminxX/update/products [NC]
RewriteRule .* products.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/AdminxX/update/gateways [NC]
RewriteRule .* gateways.php [L]