Timeline for Redirect www to non-www htaccess
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 24, 2019 at 10:36 | vote | accept | Adrihin | ||
Dec 13, 2019 at 20:03 | comment | added | Trisha | This takes any request for either the www. version or non-www. version as well as http (vs https) requests and sends them ALL to the httpS non-www version. It captures all with the fewest lines of code. | |
Dec 12, 2019 at 19:29 | comment | added | MrWhite | "your HTTP_HOST has the www in it" - I assume you are referring to the first code block in @Elgoots answer? Yes, true, but WordPress itself should have then canonicalised the www subdomain. And this does not apply to the 2nd code block, given the order of the two rules (since the www subdomain would already have been removed by the time the second rule was processed). | |
Dec 12, 2019 at 19:20 | comment | added | MrWhite |
But this is "only" an HTTP to HTTPS redirect. This will fail to canonicalise the www subdomain in a request for https://www.website.com (as stated in the question) - leaving it up to WordPress itself to canonicalise the request later (which it may well be doing). The first condition is superfluous - as it will always be successful (assuming we are dealing with just a single domain).
|
|
Dec 12, 2019 at 15:48 | comment | added | Trisha | @elgoots, yep me too, I try to only answer questions in the morning AFTER I've had a cup of coffee! | |
Dec 11, 2019 at 15:09 | comment | added | Adrihin | You just made me a happy man. Thanks! I can't remember how many different combinations I tried! Thanks also to you Elgoots :) | |
Dec 11, 2019 at 2:17 | comment | added | Elgoots | sigh. you are right. derp. this is why i shouldnt answer questions at 4am lol | |
Dec 10, 2019 at 20:22 | history | answered | Trisha | CC BY-SA 4.0 |