Reputation: 811
Its hard to splain in the title.. my problem is this:
Here is my .htaccess :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
</IfModule>
If I enter in my domain with "www" in the url, like "www.home.com", i get in $_SERVER['SERVER_NAME'] an url with "www", but if i enter in the domain without the "www" like http://home.com, the "www" exists in the $_SERVER['SERVER_NAME'] varand when i use custom function to make URLs, the server fail to make correct URL (always insert "www" even if not in the URL) and get some permision errors (like json or webservices, because domain mismatch).
I think its a .htaccess problem, not a PHP (think..)
Upvotes: 0
Views: 106
Reputation: 360702
$_SERVER['SERVER_NAME']
comes from the webserver config, e.g. Apache's ServerName
. If you want the name of the host as supplied in the url, there's $_SERVER['HTTP_HOST']
Upvotes: 4