That specific line is to redirect non-www to www. How does that fix redirecting the IP address (if a crawler gets there for some reason) to the www version of example domain?
The way you had it, it was only redirecting no-subdomain (example.com) to [noparse]www.example.com[/noparse].
What I changed it to redirects anything except [noparse]www.example.com[/noparse] to [noparse]www.example.com[/noparse] (which includes straight ip-address hits).
Thank you for clarifying this issue. Now would this also redirect parked domains that are creating duplicate content? For example, I have example.com as my main domain as well as example.net and example.org.
Reason I ask, is because I parked those domains, they redirected the homepage, but subdirectories would go to the non .com domain without redirecting or being rewritten.
Yeah. It’ll redirect everything as it should to avoid content dilution in googles eyes. Add a [L,R=301] to the end of the rule to issue a 301 permanent redirect.
I tested it last night, it works for the IP address redirection. My next test will be checking out the parked domains. I will have to change the name servers to point to my server, park them and then await propagation.