How to Fix the Trusted Host Settings Error After Installing Drupal 8

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to host settings error that you get right after you installed your plate this is an unfortunate error that comes up for everyone right after they installed Drupal 8 I'm hoping in the future that this won't be the case and then I can get rid of this video but for now well let me show you what I mean and then let me show you how to fix it so this is a fresh install Drupal I've just gone through Drupal 8 I've just gone through the installation process if I go to reports and status report and if I scroll down here to the bottom you'll see it says trusted host settings not enabled this can lead to security vulnerabilities I'm not gonna get into the details of what those are you can click this link if you want to read more about the security vulnerabilities they don't actually apply to everyone it really depends on how your hosting is set up however even if they don't apply to you you will still see this message so let's look at how we can fix it though the way to fix it is to tell Drupal what the trusted hosts are and what a trusted house is is which URLs or which domain names is this website allowed to be viewed at so we can see up here in the address bar that this particular website is at Drupal 8 DT class comm so I need to tell Drupal then that's a good domain name that this website can run from and anything else is not a valid domain name for this website now unfortunately the fix to this is extremely technical and it's a little bit dangerous which is why I'm hoping that this problem goes away in future versions but I'm going to show you how to do it you need to pay very close attention because if you make a typo you can break your site so this hope this website is hosted on a cpanel server so i'm going to log into my cPanel control panel and I'm gonna go to the file manager and in the file manager I'm gonna go into public HTML so I'll double click here on the icon and then I'm gonna go into sites default but I'm not actually I'm not gonna go into default I'm gonna need to change some permissions because what what I'm gonna do is if I go into default I need to edit this settings that PHP file but the problem is there's a permissions that locks that down here in on the default folder so the first thing I need to do is change the permissions on the default folder so so let me back up there highlight the default folder click permissions and then in the user column click write permissions so you should see 755 across the bottom and then click change permissions and then click into the default folder and do the same thing for settings dot PHP so highlight it by clicking it once click permissions and give the user write permissions now that I have the permissions to write to change this file leave it highlighted and click code editor you can leave the defaults just click edit now the file is open in the code editor and scroll to the bottom you can see there are some settings here related to my database connection I'm going to add a new line and you can you can do this just on a single you can just go down one inter line I'm gonna push it a bunch up because I know it's a little hard to see when words are at the bottom of the video so I'm gonna this way I can edit it up a little bit higher on the screen so if you scroll in this file actually if you scroll up a little bit in this file there is an example of what you need to type right up here you just see it's this trusted host configuration and then the simplest one is just three lines long okay in my file it happens to be on line 683 it may change in different versions of Drupal so if you see this settings trusted hope that post patterns but it's on a slightly different line that's probably still the right one so I'm gonna cut and paper copy and paste this so I'll highlight those three lines scroll down and paste it now these lines were originally commented out so they have these stars so the first thing I need to do is get rid of those asterisks the Stars alright and now I have a valid configuration for the trusted host patterns however it's set up to work for only example WWE sample comm so let me just show you what happens if I save that now and I try to go load my webpage I get this error message the provided host name is not valid for this server if you see an error message like that after you do this that means that you did something wrong you have a typo maybe in your trusted host pattern so go back and check it again so I need to put in here my real domain name and then this and you can see this is where it gets kind of complicated so the pattern is that there's a little caret symbol so that a little pointy thing over the six at least on my keyboard and there's a dollar sign at the end and then before every period in the domain name there's a backslash so I just need to fill this in with my domain name Drupal whoops Drupal 8 DT class.com okay that matches mine then I click Save now if I go over here and i refresh my sites back and if I scroll down the trusted host settings is now not no longer an error message so what I should do now is close go back to see piano close the code window and then I should put the permissions back on settings dot PHP so I'm gonna highlight it click permissions uncheck the right box for the user and change permissions for settings that PHP and then I should do the same thing for the default folder so go up one level go to highlight default click permission so okay I think Drupal did it for me so I didn't have to do it there but you should probably double check it just to make sure okay so that's done correctly if it's back in the correct permissions the trusted host settings it's good and so when I go to configuration I shouldn't see I don't have that message telling me something's wrong with my site so that is how you fix the trusted host settings error in Drupal 8 hopefully you won't have to do this in the future but for now this is what you have to do
Info
Channel: DrupalTutor
Views: 14,427
Rating: 4.875 out of 5
Keywords: Drupal, Drupal 8
Id: FxIginfXTIU
Channel Id: undefined
Length: 8min 0sec (480 seconds)
Published: Wed Feb 10 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.