Case of the 301 redirection to the root domain name

Modified on Fri, 4 Feb, 2022 at 2:33 PM

When your fully qualified domain name ( www.example.com) makes a 301 (or 302) redirect to the root domain nome ( example.com), users who try to load  www.example.com will load  example.com and will not benefit from the optimized version of the site. 


In this case, the pages are not optimized by Fasterize. Indeed, Fasterize does not work completely on root domains . 


To take advantage of the Fasterize service, you must remove this 301 redirect. 

Removing 301 redirection on the main WEB server

Here are some tips to remove this redirection in the most popular web server: 


  • Apache : edit your file  .htaccess, and look for the string "301". Delete the corresponding line after verifying that it matches the desired redirection.
  • WordPress : if you have a redirection plugin, consult the documentation associated with your plugin. Otherwise, edit your .htaccess file, and look for the string "301". Delete the corresponding line after verifying that it matches the desired redirection.
  • PHP : Find and delete the following lines of your code: 
    Header ("HTTP/1.1 301 Moved Permanently");
    
    Header ("Location: http://example.com");
    Note: Replace  http://example.com with your domain name.
  • IIS : In  Internet Services Manager , right-click the file or directory of the fully qualified domain name. Check the box  A directory located on this computer

Conversely, if you want to benefit from Fasterize for all visitors to your site, we recommend that you set up a 301 redirect from your root domain name ( example.com ) to your fully qualified  domain name ( www.example.com ).


After activating the http -> https redirection feature, we recommend that you purge the cache of HTML pages via ourdashboard.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article