0

I decided to change the URL of my Drupal site since it's not secure to include the IP address in it. So in my settings.php I have:

$settings['trusted_host_patterns'] = array(
  '^forms\.org$',
  '^www\.forms\.org$',
);

I cleared the cache using drush cr but the trusted host settings in the status report are still not updated. I even checked the permissions and everything is fine.

New contributor
mins is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
4
  • You are using probably the wrong settings.php or you have the statement twice in the settings.php file.
    – 4k4
    Jan 13 at 20:03
  • settings.php file is under project/web/sites/default which I am sure is right. That's where I have my initial address. And no, there is only one statement. :/
    – mins
    Jan 13 at 20:25
  • There's an easy way to find out - put some nonsense (i.e. invalid PHP) at the bottom of settings.php and reload the page. If it's not a 500, that settings.php isn't being read. Also check files that you're including via settings.php
    – Clive
    Jan 13 at 20:36
  • "files that you are including via settings.php"? However, the site loads when I use the old URL, which is the ip address one even after I commented it out, whereas the new address says "files not found"
    – mins
    Jan 13 at 20:44
1

However, the site loads when I use the old URL, which is the ip address one even after I commented it out

When you have commented the trusted host setting out the site works normally for all domains or IPs, you only get a warning if you open the status page.

whereas the new address says "files not found"

This error is not connected to this issue and it's unlikely a Drupal issue at all. Check the VirtualHost of the new address in your web server configuration. You can also test the new domain name with a static HTML file before you start to debug Drupal.

1
  • Thank you for your time to answer. I have "forms.org *.forms.org" in ServerAlias of drupal.conf, restarted the httpd and enabled it and still the same. I even tried with https.
    – mins
    Jan 14 at 15:08

Your Answer

mins is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.