Subdomain rule redirect with www

We’d like to redirect a subdomain to the correct URL without www.

For example:

  1. If you went to https://david.domain.com, it should redirect you to https://domain.com/david

We have tried these rules:

  1. https://*.domain[dot]com/ > https://domain[dot]com/$1

The problem is if you tried to goto www.domain.com, it’s trying to retrieve the $1, when you just want to goto the main website…

The first Page Rule that matches the path will be executed, and all others will be ignored. In your case:

will match https://www.example.com. If you want to exclude https://www.example.com from the match, then you need to create a dummy page rule that appears higher up the list than the wildcard, and that matches the domain you want to exclude. A dummy page rule can just set any setting that is already being set in your default configuration. For example, if your default SSL Mode is Full (Strict), just set the SSL Mode in a page rule for https://www.example.com to Full (Strict). As only one Page Rule will ever be executed on a request, the dummy will prevent the wildcard redirect page rule from being matched.

If you have multiple subdomains, as that’s what it sounds like you’re trying to do with a wildcard, you’ll need to put in a filler rule for ‘www’ so it triggers before the wildcard rule does.

Something like Match: www.example.com/* with a setting of Automatic HTTPS Rewrites (On).

Then Rule 2 can be your *.domain redirect.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.