Jika Halaman Drupal Anda sudah dikonfigurasi untuk mengaktifkan trusted host lalu ketika halaman dibuka Anda mendapatkan error dengan pesan : “The provided host name is not valid for this server”
Baca juga : Cara Menggunakan HTTPS di Drupal
$settings['trusted_host_patterns'] = [
'^www\.ahmadzaelani\.com$',
];
Maka dikala diakses tanpa www, situs akan memperlihatkan error “The provided host name is not valid for this server”.
Untuk menanggulangi masalah tersebut, Anda mampu melakukan setting pada file .htaccess agar halaman website senantiasa diarahkan menggunakan www. Caranya :
Buka file .htaccess kemudian cari bab bari mirip berikut ini :
# To redirect all users to access the site WITH the 'www.' prefix, # (http://example.com/... will be redirected to http://www.example.com/...) # uncomment the following: #RewriteCond %HTTP_HOST . #RewriteCond %HTTP_HOST !^www\. [NC] #RewriteRule ^ http%ENV:protossl://www.%HTTP_HOST%REQUEST_URI [L,R=301]
Selanjutnya rubahlah menjadi seperti berikut :
# To redirect all users to access the site WITH the 'www.' prefix, # (http://example.com/... will be redirected to http://www.example.com/...) # uncomment the following: RewriteCond %HTTP_HOST . RewriteCond %HTTP_HOST !^www\. [NC] RewriteRule ^ http%ENV:protossl://www.%HTTP_HOST%REQUEST_URI [L,R=301]
Dengan cara diatas, maka domain Anda akan senantiasa diakses dengan www sehingga error yang terjadi sesudah mengaktikan trusted host tidak muncul kembali.
EmoticonEmoticon