# Https/www version connection time out

**URL:** <https://community.ovhcloud.com/t/https-www-version-connection-time-out/22701>\
**Category:** Domaines et Hébergements\
**Created:** [February 23, 2021, 12:06pm UTC](https://community.ovhcloud.com/t/https-www-version-connection-time-out/22701 "2021-02-23T12:06:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BarbaraM1](https://community.ovhcloud.com/letter_avatar/barbaram1/32/6_22734026db12803ebb3e059622ac3534.png) [@BarbaraM1](https://community.ovhcloud.com/u/BarbaraM1)\
**Post date:** [February 23, 2021, 12:06pm UTC](https://community.ovhcloud.com/t/https-www-version-connection-time-out/22701/1 "2021-02-23T12:06:28Z")

</div>

Hello! I'm configuring my htaccess file to achieve the following:  
force https (redirect http to https)  
force non-www version (redirect www. host. it to host. it)  
remove filename extensions (host. it/page. html becomes host. it /page/)  
  
current status:  
http s://domain. it -\> desired result, works  
http:// domain. it -\> redirects to [https://domain.it](https://domain.it) -\> desired result, works  
http:// www. domain. it -\> redirects to [https://domain.it](https://domain.it) -\> desired result, works  
http s:// www. domain. it \> CONNECTION TIME OUT error (not a redirect loop!)  
  
this is my .htacess, I can't find any error, what could this be due to? Thanks for any help!  
  
RewriteEngine on  
Options +FollowSymlinks  
# Redirects www to non-www  
RewriteCond %{HTTPS} off  
RewriteCond %{HTTP\_HOST} ^www.(._)$ [NC]  
RewriteRule ^(._)$ https://%1/$1 [R=301,L]  
  
RewriteCond %{HTTPS} on  
RewriteCond %{HTTP\_HOST} ^www.(._)$ [NC]  
RewriteRule ^(._)$ https://%1/$1 [R=301,L]  
  
# Redirects http to https protocol  
RewriteCond %{HTTPS} !on  
RewriteRule (._) https://%{HTTP\_HOST}%{REQUEST\_URI} [R=301,L]_  
  
  
  
_RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^([^/]+)/$ $1.html  
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html_  
  
_RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteCond %{REQUEST\_FILENAME} !-d  
RewriteCond %{REQUEST\_URI} !(.[a-zA-Z0-9]{1,5}|/)$  
RewriteRule (._)$ /$1/ [R=301,L]  
  
#Redirect 404 to home  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule . / [L,R=301]  
  
  
##Caching schema  
  
Header set Cache-Control "proxy-revalidate, max-age=86400"  
  
  
##Prevent viewing of .htaccess file  
  
order allow,deny  
deny from all  
  
  
##Prevent directory listings  
Options All -Indexes  
  
#Gzip compression  
  
 mod\_gzip\_on Yes  
 mod\_gzip\_dechunk Yes  
 mod\_gzip\_item\_include file .(html?|txt|css|js|php|pl)$  
 mod\_gzip\_item\_include handler ^cgi-script$  
 mod\_gzip\_item\_include mime ^text/.  
 _mod\_gzip\_item\_include mime ^application/x-javascript._  
 mod\_gzip\_item\_exclude mime ^image/.  
 _mod\_gzip\_item\_exclude rspheader ^Content-Encoding:.gzip._  
  
   
_#Block Spam Bots  
 RewriteCond %{HTTP\_USER\_AGENT} ^(aesop\_com\_spiderman|alexibot|backweb|bandit|batchftp|bigfoot) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(black.?hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(cosmos|crescent|curl|custo|da|diibot|disco|dittospyder|dragonfly) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^(joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^web(zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|reaper|sauger|site.?quester|whack) [NC,OR]  
 RewriteCond %{HTTP\_USER\_AGENT} ^._(craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|collector|grabber|webpictures).\*$ [NC]  
 RewriteRule . - [F,L]This text will be hidden
