A
A
Alexander2020-11-01 10:03:46
htaccess
Alexander, 2020-11-01 10:03:46

How to set redirects in .htaccess from all possible addresses to the final address?

It is necessary to set 301 redirects in .htaccess. The bottom line is that in all these cases there should be at most one redirect to the final address, and not several consecutive ones.
The final redirect address should be https://www.site.com

User-entered addresses that should trigger 301 redirects:

  • site.com -> https://www.site.com ;
  • http://www.site. com -> https://www.site.com ;
  • www. site. com -> https://www.site.com ;
  • https:// site. com -> https://www.site.com ;


Same with index.php:
  • site. com/index.php -> https://www.site.com ;
  • http:// www. site. com/index.php -> https://www.site.com ;
  • www. site. com/index.php -> https://www.site.com ;
  • https:// site. com/index.php -> https://www.site.com ;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question