0

I've been handed a website using cloudflare workers to redirect a wordpress blog hosted in a subdomain to a subdirectory - for the most part it's a copypaste from this cloudflare article plus an if-check to redirect to the right locale - in other words:

etc.

Of course they found out that crawlers and users could still access the original blog.companyname.com address, and asked me if I could somehow stop this host being directly accessible without causing issues for regular traffic. Couldn't come up with a working solution using .htaccess trying to redirect everything excluding the Cloudflare IP block, and I'm wondering if i'm using the wrong approach (I'm a designer and wordpress developer by trade, definitely not a sysop/devop).

The blog is hosted on a managed solution using apache 2.4.6. Any suggestion is greatly appreciated.

  • Does this answer your question? [Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About mod\_rewrite Rules but Were Afraid to Ask](https://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever) – Dennis Nolte Jun 08 '22 at 20:34
  • Thanks for this guide! unfortunately it seems to be quite a generic explanation, there's very little regarding redirects based on matching incoming sources, except for a tiny bit on matching %{HTTP_REFERER} . – memory noise Jun 08 '22 at 21:17

0 Answers0