• Do you know if there is any setting that takes care of redirects.

    I have a site with a Site URL without www – so the Site URL is https://mywebsite.com

    For some reason it when I open https://www.mywebsite.com this will not redirect to https://mywebsite.com and therefore triggering some CORS errors

    When I disable your plugin or just call the URL without caching e.g. https://www.mywebsite.com?nocache then it’ll redirect to https://mywebsite.com?nocache

    Any idea what I need to look into here? I purged all caches already several times. No other cache plugin installed. Litespeed server on cPanel but not using the Litespeed cache plugin as of now.

    The page rule in Cloudflare also states https://mywebsite.com/* Cache Level: Cache Everything

    I don’t know why the redirect is not working to the Site URL when your plugin is enabled

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @markussss,
    You can easily create a bulk redirection rule to redirect WWW traffic to non www URL inside Cloudflare. Please check: https://developers.cloudflare.com/pages/how-to/www-redirect/

    You can also take advantage of Cloudflare Page Rules to do the same thing. Please check: https://community.cloudflare.com/t/redirect-example-com-to-www-example-com/78348

    Thread Starter markussss

    (@markussss)

    Hi @isaumya

    I didn’t go into Cloudflare redirect rules yet (will check the links) because it looked so strange to me that it does work correctly with the plugin disabled, and does not work as should with the plugin enabled.

    The website is anyway behind Cloudflare (with and without your plugin), that’s why it looked odd to me that it acted this way.

    A temporary fix I figured out was to disable the Fallback Cache of your plugin. When you read my initial message, does this make sense to you?

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @markussss,
    When your website is behind a reverse proxy such as Cloudflare, those redirects should be handled at the Cloudflare edge level so that the request doesn’t have to come to the origin server to get redirected, instead Cloudflare can take action immediately (whether you set things up with Bulk Redirection Rules or Page Rules).

    Thread Starter markussss

    (@markussss)

    @isaumya while I look at the redirects – I still don’t understand that it works when I disable Fallback cache. I don’t need to change any rules and redirect rules. It just works as expected when the Fallback cache is disabled. And it doesn’t work when it is enabled. That part does not make fully sense to me just yet

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @markussss,
    Cause when fallback cache is enabled, then if the page is not cached in the Cloudflare CDN edge, then before executing full PHP to generate the page, the server first looks inside the fallback cache to see if cached version of the page exists and if so then return that page. That’s why I suggested you to implement the redirect at the Cloudflare dashboard.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Redirect to non-www URL not working’ is closed to new replies.