Jump to content

$config->httpHosts vs $_SERVER['httpHosts']


bernhard
 Share

Recommended Posts

hi

today i came up with a small problem with my multisite setup on my plesk vserver: if i ceate a "subscription" for a domain like example.com i can choose the favourite url (www.example.com or example.com) redirected by a 301. on multisite domains that does not work because they are "domain aliases" where i can't set up the favourite url.

so i tried something like this: https://processwire.com/talk/topic/7705-website-for-german-investment-company/?p=74908 and realised that $config->httpHost returns example.com wheter you are requesting it with or without www whereas $_SERVER['httpHost'] returns the "full" url with or without the www.

is there any reason for that?

i solved it by uncommenting the 2 lines in the .htaccess

  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

what leads me to my second question:

i'm afraid when i upgrade pw some day i could forget to uncomment those 2 lines. is there any best practise or the like for this problem? how do you do that? do you add comments to all the changed lines?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...