Redirect Rule to transform to HTTPS and URL (regex) at the same time

Hi,

I want to create one Redirect Rule to redirect from
http://example.com/photos/ANYLABEL (non HTTPS version)
to
https://example.com/product/ANYLABEL/#photos (HTTPS version)
where ‘ANYLABEL’ is the label of the product.

As far as I understand, this is a regex issue. I’ve got a Pro plan in Cloudflare, not sure if I’m allowed to this.

Currently, I’m doing this in Apache .htaccess. However, this involves two 301 redirects:

  1. http://example.com/photos/ANYLABELhttps://example.com/photos/ANYLABEL (performed in the ‘Always Use HTTPS’ of Cloudflare)
  2. https://example.com/photos/ANYLABELhttps://example.com/product/ANYLABEL/#photos (performed in origin’s Apache .htaccess)

Any help is appreciated

2 posts were merged into an existing topic: How to redirect ‘http://sub.example.com’ to ‘https://example.com’ in just 1 step