Skip to content

Redirect admin area requests to HTTPS

Create a redirect rule to redirect requests for the administration area of store.example.com to HTTPS, keeping the original path and query string.

This example single redirect for zone example.com will redirect requests for the administration area of a specific subdomain (store.example.com) to HTTPS, keeping the original path and query string.

When incoming requests match

  • Wildcard pattern
    • Request URL: http://store.example.com/admin*

Then

  • Target URL: https://store.example.com/admin${1}
  • Status code: 301
  • Preserve query string: Enabled

The request URL ends in /admin*, so it also matches other paths that start with /admin, such as /administrator/. To redirect only the admin area, use the request URL http://store.example.com/admin/* with the target URL https://store.example.com/admin/${1}. This pattern does not match /admin without a trailing slash, so create a second rule for that URL if needed.

For example, the redirect rule would perform the following redirects:

Request URL Target URL Status code
http://store.example.com/admin/products/ https://store.example.com/admin/products/ 301
https://store.example.com/admin/products/ (unchanged) n/a
http://store.example.com/admin/?logged_out=true https://store.example.com/admin/?logged_out=true 301
http://store.example.com/?all_items=true (unchanged) n/a
http://example.com/admin/ (unchanged) n/a

Was this helpful?